User: xtoff
Date: 2009/12/15 11:42 AM
Modified:
/InversionOfControl/trunk/src/Castle.MicroKernel.Tests/
MicroKernelTestCase.cs
/InversionOfControl/trunk/src/Castle.MicroKernel/ComponentActivator/
DefaultComponentActivator.cs
/InversionOfControl/trunk/src/Castle.MicroKernel/Context/
DependencyTrackingScope.cs
/InversionOfControl/trunk/src/Castle.MicroKernel/Lifestyle/
PerWebRequestLifestyleManager.cs
/InversionOfControl/trunk/src/Castle.MicroKernel/Resolvers/
DefaultDependencyResolver.cs
/InversionOfControl/trunk/src/Castle.Windsor.Tests/Configuration2/
SynchronizationProblemTestCase.cs
Log:
- swapped all usages of hardcoded \r\n to Environment.NewLine to better
support Mono
File Changes:
Directory: /InversionOfControl/trunk/src/Castle.MicroKernel.Tests/
==================================================================
File [modified]: MicroKernelTestCase.cs
Delta lines: +1 -1
===================================================================
---
InversionOfControl/trunk/src/Castle.Windsor.Tests/Configuration2/SynchronizationProblemTestCase.cs
2009-12-15 17:38:21 UTC (rev 6429)
+++
InversionOfControl/trunk/src/Castle.Windsor.Tests/Configuration2/SynchronizationProblemTestCase.cs
2009-12-15 18:42:27 UTC (rev 6430)
@@ -84,7 +84,7 @@
}
catch(Exception ex)
{
- Console.WriteLine(DateTime.Now.Ticks +
" ---------------------------\r\n" + ex);
+ Console.WriteLine(DateTime.Now.Ticks +
" ---------------------------" + Environment.NewLine + ex);
}
}
Directory: /InversionOfControl/trunk/src/Castle.MicroKernel/ComponentActivator/
===============================================================================
File [modified]: DefaultComponentActivator.cs
Delta lines: +7 -3
===================================================================
---
InversionOfControl/trunk/src/Castle.MicroKernel/Context/DependencyTrackingScope.cs
2009-12-15 17:38:21 UTC (rev 6429)
+++
InversionOfControl/trunk/src/Castle.MicroKernel/Context/DependencyTrackingScope.cs
2009-12-15 18:42:27 UTC (rev 6430)
@@ -64,17 +64,21 @@
if (extendedInfo != null)
{
- sb.AppendFormat("\r\n - {0} for
{1} in type {2}",
+ sb.AppendLine();
+ sb.AppendFormat(" - {0} for {1}
in type {2}",
key,
extendedInfo.Info, extendedInfo.Info.DeclaringType);
}
else
{
- sb.AppendFormat("\r\n - {0}",
key);
+ sb.AppendLine();
+ sb.AppendFormat(" - {0}", key);
}
}
- sb.AppendFormat("\r\n + {0} for {1} in {2}\r\n",
+ sb.AppendLine();
+ sb.AppendFormat(" + {0} for {1} in {2}",
dependencyModel, info,
info.DeclaringType);
+ sb.AppendLine();
throw new
CircularDependencyException(sb.ToString());
Directory: /InversionOfControl/trunk/src/Castle.Windsor.Tests/Configuration2/
=============================================================================
File [modified]: SynchronizationProblemTestCase.cs
Delta lines: +0 -0
===================================================================
Directory: /InversionOfControl/trunk/src/Castle.MicroKernel/Context/
====================================================================
File [modified]: DependencyTrackingScope.cs
Delta lines: +2 -2
===================================================================
---
InversionOfControl/trunk/src/Castle.MicroKernel/Lifestyle/PerWebRequestLifestyleManager.cs
2009-12-15 17:38:21 UTC (rev 6429)
+++
InversionOfControl/trunk/src/Castle.MicroKernel/Lifestyle/PerWebRequestLifestyleManager.cs
2009-12-15 18:42:27 UTC (rev 6430)
@@ -43,8 +43,8 @@
if (!PerWebRequestLifestyleModule.Initialized)
{
string message = "Looks like you forgot
to register the http module " +
-
typeof(PerWebRequestLifestyleModule).FullName +
- "\r\nAdd '<add
name=\"PerRequestLifestyle\"
type=\"Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule,
Castle.MicroKernel\" />' " +
+
typeof(PerWebRequestLifestyleModule).FullName + Environment.NewLine +
+ "Add '<add
name=\"PerRequestLifestyle\"
type=\"Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule,
Castle.MicroKernel\" />' " +
"to the <httpModules>
section on your web.config";
Directory: /InversionOfControl/trunk/src/Castle.MicroKernel/Lifestyle/
======================================================================
File [modified]: PerWebRequestLifestyleManager.cs
Delta lines: +5 -5
===================================================================
---
InversionOfControl/trunk/src/Castle.MicroKernel/Resolvers/DefaultDependencyResolver.cs
2009-12-15 17:38:21 UTC (rev 6429)
+++
InversionOfControl/trunk/src/Castle.MicroKernel/Resolvers/DefaultDependencyResolver.cs
2009-12-15 18:42:27 UTC (rev 6430)
@@ -341,11 +341,11 @@
if (handler == null)
{
throw new
DependencyResolverException(
- "Cycle detected in
configuration.\r\n" +
- "Component " +
model.Name + " has a dependency on " +
- dependency.TargetType +
", but it doesn't provide an override.\r\n" +
- "You must provide an
override if a component " +
- "has a dependency on a
service that it - itself - provides");
+ string.Format(
+ "Cycle detected
in configuration.{2}Component {0} has a dependency on {1}, but it doesn't
provide an override.{2}You must provide an override if a component has a
dependency on a service that it - itself - provides",
+ model.Name,
+
dependency.TargetType,
+
Environment.NewLine));
}
}
Directory: /InversionOfControl/trunk/src/Castle.MicroKernel/Resolvers/
======================================================================
File [modified]: DefaultDependencyResolver.cs
Delta lines: +51 -30
===================================================================
---
InversionOfControl/trunk/src/Castle.MicroKernel.Tests/MicroKernelTestCase.cs
2009-12-15 17:38:21 UTC (rev 6429)
+++
InversionOfControl/trunk/src/Castle.MicroKernel.Tests/MicroKernelTestCase.cs
2009-12-15 18:42:27 UTC (rev 6430)
@@ -204,66 +204,87 @@
Assert.AreEqual(customer2.GetType(),
typeof(CustomerImpl2));
}
- [Test, ExpectedException(typeof(ComponentRegistrationException),
- ExpectedMessage =
- "Type
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent is abstract.\r\n
As such, it is not possible to instansiate it as implementation of
Castle.MicroKernel.Tests.ClassComponents.ICommon service"
- )]
+ [Test]
public void
ShouldNotRegisterAbstractClassAsComponentImplementation_With_Simple_Signature()
{
kernel.AddComponent("abstract", typeof(ICommon),
typeof(BaseCommonComponent));
- kernel.Resolve<ICommon>("abstract");
+
+ string expectedMessage = string.Format("Type
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent is abstract.{0} As
such, it is not possible to instansiate it as implementation of
Castle.MicroKernel.Tests.ClassComponents.ICommon service", Environment.NewLine);
+ var exception =
+
Assert.Throws(typeof(ComponentRegistrationException), () =>
+ {
+ kernel.Resolve<ICommon>("abstract");
+ });
+ Assert.AreEqual(expectedMessage,exception.Message);
}
- [Test, ExpectedException(typeof(ComponentRegistrationException),
- ExpectedMessage =
- "Type
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent is abstract.\r\n
As such, it is not possible to instansiate it as implementation of
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent service"
- )]
+ [Test]
public void
ShouldNotRegisterAbstractClass_With_Simple_Signature()
{
kernel.AddComponent("abstract",
typeof(BaseCommonComponent));
- kernel.Resolve<ICommon>("abstract");
+ string expectedMessage = string.Format("Type
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent is abstract.{0} As
such, it is not possible to instansiate it as implementation of
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent service",
Environment.NewLine);
+ var exception =
+
Assert.Throws(typeof(ComponentRegistrationException), () =>
+ {
+ kernel.Resolve<ICommon>("abstract");
+ });
+ Assert.AreEqual(expectedMessage, exception.Message);
}
- [Test, ExpectedException(typeof(ComponentRegistrationException),
- ExpectedMessage =
- "Type
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent is abstract.\r\n
As such, it is not possible to instansiate it as implementation of
Castle.MicroKernel.Tests.ClassComponents.ICommon service"
- )]
+ [Test]
public void
ShouldNotRegisterAbstractClassAsComponentImplementation_With_LifestyleType_Signature()
{
kernel.AddComponent("abstract", typeof(ICommon),
typeof(BaseCommonComponent), LifestyleType.Pooled);
- kernel.Resolve<ICommon>("abstract");
+ string expectedMessage = string.Format("Type
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent is abstract.{0} As
such, it is not possible to instansiate it as implementation of
Castle.MicroKernel.Tests.ClassComponents.ICommon service", Environment.NewLine);
+ var exception =
+
Assert.Throws(typeof(ComponentRegistrationException), () =>
+ {
+ kernel.Resolve<ICommon>("abstract");
+ });
+ Assert.AreEqual(expectedMessage, exception.Message);
}
- [Test, ExpectedException(typeof(ComponentRegistrationException),
- ExpectedMessage =
- "Type
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent is abstract.\r\n
As such, it is not possible to instansiate it as implementation of
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent service"
- )]
+ [Test]
public void
ShouldNotRegisterAbstractClass_With_LifestyleType_Signature()
{
kernel.AddComponent("abstract",
typeof(BaseCommonComponent), LifestyleType.Pooled);
- kernel.Resolve<ICommon>("abstract");
+
+ string expectedMessage = string.Format("Type
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent is abstract.{0} As
such, it is not possible to instansiate it as implementation of
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent service",
Environment.NewLine);
+ var exception =
+
Assert.Throws(typeof(ComponentRegistrationException), () =>
+ {
+ kernel.Resolve<ICommon>("abstract");
+ });
+ Assert.AreEqual(expectedMessage, exception.Message);
}
- [Test, ExpectedException(typeof(ComponentRegistrationException),
- ExpectedMessage =
- "Type
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent is abstract.\r\n
As such, it is not possible to instansiate it as implementation of
Castle.MicroKernel.Tests.ClassComponents.ICommon service"
- )]
+ [Test]
public void
ShouldNotRegisterAbstractClassAsComponentImplementation_With_LifestyleType_And_Override_Signature()
{
kernel.AddComponent("abstract", typeof(ICommon),
typeof(BaseCommonComponent), LifestyleType.Pooled, true);
- kernel.Resolve<ICommon>("abstract");
+
+ string expectedMessage = string.Format("Type
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent is abstract.{0} As
such, it is not possible to instansiate it as implementation of
Castle.MicroKernel.Tests.ClassComponents.ICommon service", Environment.NewLine);
+ var exception =
+
Assert.Throws(typeof(ComponentRegistrationException), () =>
+ {
+ kernel.Resolve<ICommon>("abstract");
+ });
+ Assert.AreEqual(expectedMessage, exception.Message);
}
[Test]
- [ExpectedException(typeof(ComponentRegistrationException),
- ExpectedMessage =
- "Type
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent is abstract.\r\n
As such, it is not possible to instansiate it as implementation of
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent service"
- )]
public void
ShouldNotRegisterAbstractClass_With_LifestyleType_And_Override_Signature()
{
kernel.AddComponent("abstract",
typeof(BaseCommonComponent), LifestyleType.Pooled, true);
- kernel.Resolve<ICommon>("abstract");
+
+ string expectedMessage = string.Format("Type
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent is abstract.{0} As
such, it is not possible to instansiate it as implementation of
Castle.MicroKernel.Tests.ClassComponents.BaseCommonComponent service",
Environment.NewLine);
+ var exception =
+
Assert.Throws(typeof(ComponentRegistrationException), () =>
+ {
+ kernel.Resolve<ICommon>("abstract");
+ });
+ Assert.AreEqual(expectedMessage, exception.Message);
}
--
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.