summaryrefslogtreecommitdiff
path: root/slips/src/test/Marina.Test/Unit/Infrastructure/Logging
diff options
context:
space:
mode:
authormokhan <mokhan@da190166-9cfc-4ee1-ae03-434a172be219>2009-02-21 21:44:27 +0000
committermokhan <mokhan@da190166-9cfc-4ee1-ae03-434a172be219>2009-02-21 21:44:27 +0000
commit1dfdccb8118aeaa3cd844ac8de2a672c93312166 (patch)
tree4b19e7f816ab1019f180a46b68572af4b66fe4bc /slips/src/test/Marina.Test/Unit/Infrastructure/Logging
parent42d66bcab8262c7b8b2452615df535e694a3ec1c (diff)
git-svn-id: http://svn.xp-dev.com/svn/mokhan-sait@2 da190166-9cfc-4ee1-ae03-434a172be219
Diffstat (limited to 'slips/src/test/Marina.Test/Unit/Infrastructure/Logging')
-rw-r--r--slips/src/test/Marina.Test/Unit/Infrastructure/Logging/Interfaces/LogTest.cs36
-rw-r--r--slips/src/test/Marina.Test/Unit/Infrastructure/Logging/TextWriterLogging/TextWriterLogFactoryTest.cs19
-rw-r--r--slips/src/test/Marina.Test/Unit/Infrastructure/Logging/TextWriterLogging/TextWriterLogTest.cs26
3 files changed, 81 insertions, 0 deletions
diff --git a/slips/src/test/Marina.Test/Unit/Infrastructure/Logging/Interfaces/LogTest.cs b/slips/src/test/Marina.Test/Unit/Infrastructure/Logging/Interfaces/LogTest.cs
new file mode 100644
index 0000000..504d598
--- /dev/null
+++ b/slips/src/test/Marina.Test/Unit/Infrastructure/Logging/Interfaces/LogTest.cs
@@ -0,0 +1,36 @@
+using Marina.Infrastructure.Container;
+using Marina.Infrastructure.Logging.Interfaces;
+using MbUnit.Framework;
+using Rhino.Mocks;
+
+namespace Marina.Test.Unit.Infrastructure.Logging.Interfaces {
+ [TestFixture]
+ public class LogTest {
+ private MockRepository mockery;
+
+ [SetUp]
+ public void SetUp( ) {
+ mockery = new MockRepository( );
+ }
+
+ [Test]
+ public void Should_leverage_factory_to_return_a_logger_to_the_client( ) {
+ ILog mockLog = mockery.DynamicMock< ILog >( );
+ ILogFactory mockLogFactory = mockery.DynamicMock< ILogFactory >( );
+
+ IDependencyContainer mockContainer = mockery.DynamicMock< IDependencyContainer >( );
+
+ using ( mockery.Record( ) ) {
+ Expect.Call( mockContainer.GetMeAnImplementationOfAn< ILogFactory >( ) ).Return( mockLogFactory );
+ Expect.Call( mockLogFactory.CreateFor( typeof( LogTest ) ) ).Return( mockLog );
+ }
+
+ using ( mockery.Playback( ) ) {
+ Resolve.InitializeWith( mockContainer );
+ ILog log = Log.For( this );
+ Assert.AreEqual( mockLog, log );
+ Resolve.InitializeWith( null );
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/slips/src/test/Marina.Test/Unit/Infrastructure/Logging/TextWriterLogging/TextWriterLogFactoryTest.cs b/slips/src/test/Marina.Test/Unit/Infrastructure/Logging/TextWriterLogging/TextWriterLogFactoryTest.cs
new file mode 100644
index 0000000..7827274
--- /dev/null
+++ b/slips/src/test/Marina.Test/Unit/Infrastructure/Logging/TextWriterLogging/TextWriterLogFactoryTest.cs
@@ -0,0 +1,19 @@
+using Marina.Infrastructure.Logging.Interfaces;
+using Marina.Infrastructure.Logging.TextWriterLogging;
+using MbUnit.Framework;
+
+namespace Marina.Test.Unit.Infrastructure.TextWriterLogging {
+ [TestFixture]
+ public class TextWriterLogFactoryTest {
+ [Test]
+ public void Should_create_a_text_writer_log( ) {
+ ILog log = CreateSUT( ).CreateFor( this.GetType( ) );
+ Assert.IsNotNull( log );
+ Assert.IsInstanceOfType( typeof( TextWriterLog ), log );
+ }
+
+ private ILogFactory CreateSUT( ) {
+ return new TextWriterLogFactory( );
+ }
+ }
+} \ No newline at end of file
diff --git a/slips/src/test/Marina.Test/Unit/Infrastructure/Logging/TextWriterLogging/TextWriterLogTest.cs b/slips/src/test/Marina.Test/Unit/Infrastructure/Logging/TextWriterLogging/TextWriterLogTest.cs
new file mode 100644
index 0000000..526590c
--- /dev/null
+++ b/slips/src/test/Marina.Test/Unit/Infrastructure/Logging/TextWriterLogging/TextWriterLogTest.cs
@@ -0,0 +1,26 @@
+using System.IO;
+using System.Text;
+using Marina.Infrastructure.Logging.Interfaces;
+using Marina.Infrastructure.Logging.TextWriterLogging;
+using MbUnit.Framework;
+
+namespace Marina.Test.Unit.Infrastructure.TextWriterLogging {
+ [TestFixture]
+ public class TextWriterLogTest {
+ [Test]
+ public void Should_log_message_to_backing_store( ) {
+ string expectedMessage = "Message";
+
+ StringWriter writer = new StringWriter( new StringBuilder( ) );
+
+ ILog consoleLogger = CreateSUT( writer );
+ consoleLogger.Informational( expectedMessage );
+
+ Assert.AreEqual( expectedMessage, writer.ToString( ).Trim( ) );
+ }
+
+ private ILog CreateSUT( TextWriter writer ) {
+ return new TextWriterLog( writer );
+ }
+ }
+} \ No newline at end of file