Although this is an issue for the dev list to discuss I don't think that making the log4net assembly dependant on NMock would be a good idea. Ideally the core of log4net should have as few dependencies as possible.
It should be straight forward to add the mock appender to the tests project as the impact of changing dependencies here is not high. If the mock appender is generally useful then we can consider building and shipping the test assembly with log4net distributions. This would allow you to reference the mock directly from the test assembly. Nicko > -----Original Message----- > From: Thibaut Barr�re [mailto:[EMAIL PROTECTED] > Sent: 03 May 2005 12:51 > To: Log4NET User > Subject: Re: A mock log4net appender > > I see two possible uses : > - in log4net test project (adding a nmock dependency is not > big deal there I suppose) > - in log4net itself, for end-users (such as Owen or me). > > Do you want to also target the second option ? We would then > have a dependency on nmock which you may want to avoid. If > it's no big deal I can target the two options at once (I'd > add the mock appender inside the log4net project, and use it > in the test project). > > cheers > > Thibaut > > 2005/5/3, Nicko Cadell <[EMAIL PROTECTED]>: > > A mock appender sounds like a good idea for our tests. > Currently the tests use a combination of different appenders, > but mostly the CountingAppender. > > > http://cvs.apache.org/viewcvs.cgi/logging-log4net/tests/src/Appender/C > > ountingAppender.cs > > > > To submit your mock appender please use the issue tracking system. > > http://issues.apache.org/jira/browse/LOG4NET > > > > Create a new issue for your patch. On the log4net issues > home page select the Create New Issue from the menu bar. You > will need to be logged into JIRA in order to create an issue. > > > > Select the issue type as appropriate. > > > > Prefix the summary with [PATCH]. Enter a description of the > changes made, new features, or bug fixes in your patch. > > > > Once the issue has been created you can attach your patch > file to the issue by selecting the Attach file to this issue > operation from the left hand menu. When attaching your patch > you must select the Grant license to ASF for inclusion in ASF > works option. If attaching a patch please include in the > description the baseline version of log4net you used to build > your patch, if against a CVS version please include the date > and branch (e.g. HEAD). > > > > If you have other files to attach, e.g. you have added new > files to log4net, then attach each file separately. Please > include in the description the name of the file attached and > the path it should live in the project. > > > > Cheers, > > Nicko > > > > > -----Original Message----- > > > From: Thibaut Barr�re [mailto:[EMAIL PROTECTED] > > > Sent: 27 April 2005 19:29 > > > To: Log4NET User > > > Subject: A mock log4net appender > > > > > > Hi, > > > > > > I wrote a mock log4net appender to ensure that my unit > tests fails > > > when some errors are (sometimes silently) logged through log4net. > > > > > > Sample usage in NUnit style: > > > > > > [SetUp] > > > public void SetUp() > > > { > > > DOMConfigurator.Configure(); > > > > > > // create a mock log4net appender to verify that > no error is > > > outputted > > > mockLog4netAppender = new MockLog4netAppender(); > > > // expect zero errors > > > mockLog4netAppender.ExpectErrors(0); > > > mockLog4netAppender.RegisterAppender(); > > > } > > > > > > [TearDown] > > > public void TearDown() > > > { > > > // verify that no error was outputed by log4net > > > mockLog4netAppender.Verify(); } > > > > > > > > > Current implementation is very basic, and depends upon NMock; > > > it's actually a specialized DynamicMock, so specific > > > expectations can be added in each test when required. > > > > > > Is there some interest for including tools of this kind in > > > the log4net distribution (either as a static mock, or a > > > dynamic mock) ? Or is there an already available feature > > > which could provide the same service ? > > > > > > > > > best regards > > > > > > Thibaut Barr�re > > > > > > http://www.dotnetguru2.org/tbarrere > > > > > > >
