In my NCrunch window one of my tests is always marked as failing, even though it passes when ran. The specific test involves testing my StructureMap dependency resolver. The code from the class under test and the test class are provided below.
Class Under Test
public static class Resolver {
public static T GetConcreteInstanceOf<T>() {
return ObjectFactory.GetInstance<T>();
}
}
Test Class
[TestClass]
public class ResolverTest {
[TestMethod]
public void GetConcreteInstanceOf_ShouldReturn_LoggingService_WhenT_Is_ILoggingService() {
//Arrange
ObjectFactory.Initialize(registry => registry.Scan(x =>
{
x.AssembliesFromApplicationBaseDirectory();
x.WithDefaultConventions();
}));
//Act
ILoggingService result = Resolver.GetConcreteInstanceOf<ILoggingService>();
//Assert
result.ShouldBeType<LoggingService>();
}
}
Build/Test Issues
Issue with structure map dependency resolver test
Started by kburnell on 5,949 views
Remco NCrunch Developer
#1733
25 Apr 2012 04:57 UTC
Hi, thanks for posting!
It looks to me like this test is making assumptions about the location of assemblies within its application domain. I suggest having a read of the test issue troubleshooting guide, as it has a section that covers this - https://www.ncrunch.net/documentation/troubleshooting_test-and-runtime-related-issues
I hope this helps.
Cheers,
Remco
It looks to me like this test is making assumptions about the location of assemblies within its application domain. I suggest having a read of the test issue troubleshooting guide, as it has a section that covers this - https://www.ncrunch.net/documentation/troubleshooting_test-and-runtime-related-issues
I hope this helps.
Cheers,
Remco
Edited 25 Apr 2012 04:57 UTC
Post a reply
Log in to reply.