User: xtoff
Date: 2009/12/15 10:38 AM

Modified:
 /InversionOfControl/trunk/src/Castle.MicroKernel.Tests/
  DecoratorsTestCase.cs, RuntimeParametersTestCase.cs, 
UnsatisfiedDependenciesTestCase.cs
 /InversionOfControl/trunk/src/Castle.Windsor.Tests/
  CircularDependencyTests.cs

Log:
 - fixed some tests failing on Mono

File Changes:

Directory: /InversionOfControl/trunk/src/Castle.MicroKernel.Tests/
==================================================================

File [modified]: DecoratorsTestCase.cs
Delta lines: +5 -9
===================================================================

--- 
InversionOfControl/trunk/src/Castle.MicroKernel.Tests/RuntimeParametersTestCase.cs
  2009-12-15 17:17:59 UTC (rev 6428)
+++ 
InversionOfControl/trunk/src/Castle.MicroKernel.Tests/RuntimeParametersTestCase.cs
  2009-12-15 17:38:21 UTC (rev 6429)
@@ -14,6 +14,7 @@
 
 namespace Castle.MicroKernel.Tests
 {
+       using System;
        using System.Collections.Generic;
 
        using Castle.MicroKernel.Handlers;
@@ -48,15 +49,10 @@
                [Test]
                public void WithoutParameters()
                {
-                       var expectedMessage = @"Can't create component 'compb' 
as it has dependencies to be satisfied. 
-compb is waiting for the following dependencies: 
-
-Services: 
-- Castle.MicroKernel.Tests.RuntimeParameters.CompC which was not registered. 
-
-Keys (components with specific keys)
-- myArgument which was not registered. 
-";
+                       var expectedMessage =
+                               string.Format(
+                                       "Can't create component 'compb' as it 
has dependencies to be satisfied. {0}compb is waiting for the following 
dependencies: {0}{0}Services: {0}- 
Castle.MicroKernel.Tests.RuntimeParameters.CompC which was not registered. 
{0}{0}Keys (components with specific keys){0}- myArgument which was not 
registered. {0}",
+                                       Environment.NewLine);
                        var exception = Assert.Throws(typeof(HandlerException), 
() =>
                        {

File [modified]: RuntimeParametersTestCase.cs
Delta lines: +40 -16
===================================================================

--- 
InversionOfControl/trunk/src/Castle.MicroKernel.Tests/UnsatisfiedDependenciesTestCase.cs
    2009-12-15 17:17:59 UTC (rev 6428)
+++ 
InversionOfControl/trunk/src/Castle.MicroKernel.Tests/UnsatisfiedDependenciesTestCase.cs
    2009-12-15 17:38:21 UTC (rev 6429)
@@ -14,10 +14,12 @@
 
 namespace Castle.MicroKernel.Tests
 {
+       using System;
+
        using Castle.Core.Configuration;
        using Castle.MicroKernel.Handlers;
-       using Castle.MicroKernel.Resolvers;
        using Castle.MicroKernel.Tests.ClassComponents;
+
        using NUnit.Framework;
 
        [TestFixture]
@@ -38,18 +40,17 @@
                }
 
                [Test]
-               [ExpectedException(typeof(HandlerException))]
                public void UnsatisfiedService()
                {
                        kernel.AddComponent("key", typeof(CommonServiceUser));
-                       object instance = kernel["key"];
+
+                       Assert.Throws(typeof(HandlerException), () =>
+                       {
+                               object instance = kernel["key"];
+                       });
                }
 
                [Test]
-               [ExpectedException(typeof(HandlerException),
-                  ExpectedMessage = "Can't create component 'key' as it has 
dependencies to be satisfied. \r\nkey is waiting for the following 
dependencies: \r\n\r\n" +
-                  "Keys (components with specific keys)\r\n- name which was 
not registered. \r\n- address which was not registered. \r\n" +
-                  "- age which was not registered. \r\n")]
                public void UnsatisfiedConfigValues()
                {
                        MutableConfiguration config = new 
MutableConfiguration("component");
@@ -63,13 +64,21 @@
 
                        kernel.AddComponent("key", typeof(CustomerImpl2));
 
-                       object instance = kernel["key"];
+                       var exception =
+                               Assert.Throws(typeof(HandlerException), () =>
+                               {
+                                       object instance = kernel["key"];
+                               });
+                       var expectedMessage =
+                               string.Format(
+                                       "Can't create component 'key' as it has 
dependencies to be satisfied. {0}key is waiting for the following dependencies: 
{0}{0}" +
+                                       "Keys (components with specific 
keys){0}- name which was not registered. {0}- address which was not registered. 
{0}" +
+                                       "- age which was not registered. {0}",
+                                       Environment.NewLine);
+                       Assert.AreEqual(expectedMessage, exception.Message);
                }
 
                [Test]
-               [ExpectedException(typeof(HandlerException),
-                       ExpectedMessage = "Can't create component 'key' as it 
has dependencies to be satisfied. \r\nkey is waiting for the following 
dependencies: \r\n\r\nKeys (components with specific keys)\r\n- common2 which 
was not registered. \r\n"
-                       )]
                public void UnsatisfiedOverride()
                {
                        MutableConfiguration config = new 
MutableConfiguration("component");
@@ -83,13 +92,19 @@
 
                        kernel.AddComponent("common1", typeof(ICommon), 
typeof(CommonImpl1));
                        kernel.AddComponent("key", typeof(CommonServiceUser));
-                       object instance = kernel["key"];
+                       var exception =
+                               Assert.Throws(typeof(HandlerException), () =>
+                               {
+                                       object instance = kernel["key"];
+                               });
+                       var expectedMessage =
+                               string.Format(
+                                       "Can't create component 'key' as it has 
dependencies to be satisfied. {0}key is waiting for the following dependencies: 
{0}{0}Keys (components with specific keys){0}- common2 which was not 
registered. {0}",
+                                       Environment.NewLine);
+                       Assert.AreEqual(expectedMessage, exception.Message);
                }
 
                [Test]
-               [ExpectedException(typeof(HandlerException),
-                       ExpectedMessage = "Can't create component 'key' as it 
has dependencies to be satisfied. \r\nkey is waiting for the following 
dependencies: \r\n\r\nKeys (components with specific keys)\r\n- common2 which 
was not registered. \r\n"
-                       )]
                public void OverrideIsForcedDependency()
                {
                        MutableConfiguration config = new 
MutableConfiguration("component");
@@ -103,7 +118,16 @@
 
                        kernel.AddComponent("common1", typeof(ICommon), 
typeof(CommonImpl1));
                        kernel.AddComponent("key", typeof(CommonServiceUser3));
-                       object instance = kernel["key"];
+                       var exception =
+                               Assert.Throws(typeof(HandlerException), () =>
+                               {
+                                       object instance = kernel["key"];
+                               });
+                       var expectedMessage =
+                               string.Format(
+                                       "Can't create component 'key' as it has 
dependencies to be satisfied. {0}key is waiting for the following dependencies: 
{0}{0}Keys (components with specific keys){0}- common2 which was not 
registered. {0}",
+                                       Environment.NewLine);
+                       Assert.AreEqual(expectedMessage,exception.Message);
                }
 

File [modified]: UnsatisfiedDependenciesTestCase.cs
Delta lines: +11 -26
===================================================================

--- 
InversionOfControl/trunk/src/Castle.Windsor.Tests/CircularDependencyTests.cs    
    2009-12-15 17:17:59 UTC (rev 6428)
+++ 
InversionOfControl/trunk/src/Castle.Windsor.Tests/CircularDependencyTests.cs    
    2009-12-15 17:38:21 UTC (rev 6429)
@@ -17,7 +17,7 @@
 namespace Castle.Windsor.Tests
 {
        using System;
-       using Castle.MicroKernel.Exceptions;
+
        using Castle.MicroKernel.Handlers;
        using Castle.Windsor.Tests.Components;
        using NUnit.Framework;
@@ -37,30 +37,6 @@
                }
 
                [Test]
-               [
-                       ExpectedException(typeof(HandlerException),
-                               ExpectedMessage = @"Can't create component 
'compA' as it has dependencies to be satisfied. 
-compA is waiting for the following dependencies: 
-
-Services: 
-- Castle.Windsor.Tests.Components.CompB which was registered but is also 
waiting for dependencies. 
-
-compB is waiting for the following dependencies: 
-
-Services: 
-- Castle.Windsor.Tests.Components.CompC which was registered but is also 
waiting for dependencies. 
-
-compC is waiting for the following dependencies: 
-
-Services: 
-- Castle.Windsor.Tests.Components.CompD which was registered but is also 
waiting for dependencies. 
-
-compD is waiting for the following dependencies: 
-
-Services: 
-- Castle.Windsor.Tests.Components.CompA which was registered but is also 
waiting for dependencies. 
-"
-                               )]
                public void ThrowsACircularDependencyException2()
                {
                        IWindsorContainer container = new WindsorContainer();
@@ -69,7 +45,16 @@
                        container.AddComponent("compC", typeof(CompC));
                        container.AddComponent("compD", typeof(CompD));
 
-                       container.Resolve("compA");
+                       var exception =
+                               Assert.Throws(typeof(HandlerException), () =>
+                               {
+                                       container.Resolve("compA");
+                               });
+                       var expectedMessage =
+                               string.Format(
+                                       "Can't create component 'compA' as it 
has dependencies to be satisfied. {0}compA is waiting for the following 
dependencies: {0}{0}Services: {0}- Castle.Windsor.Tests.Components.CompB which 
was registered but is also waiting for dependencies. {0}{0}compB is waiting for 
the following dependencies: {0}{0}Services: {0}- 
Castle.Windsor.Tests.Components.CompC which was registered but is also waiting 
for dependencies. {0}{0}compC is waiting for the following dependencies: 
{0}{0}Services: {0}- Castle.Windsor.Tests.Components.CompD which was registered 
but is also waiting for dependencies. {0}{0}compD is waiting for the following 
dependencies: {0}{0}Services: {0}- Castle.Windsor.Tests.Components.CompA which 
was registered but is also waiting for dependencies. {0}",
+                                       Environment.NewLine);
+                       Assert.AreEqual(expectedMessage, exception.Message);
                }
 

Directory: /InversionOfControl/trunk/src/Castle.Windsor.Tests/
==============================================================

File [modified]: CircularDependencyTests.cs
Delta lines: +0 -0
===================================================================

--

You received this message because you are subscribed to the Google Groups 
"Castle Project Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-commits?hl=en.


Reply via email to