Skip to content

Instantly share code, notes, and snippets.

@ewilde
Created January 23, 2013 16:03
Show Gist options
  • Save ewilde/4608673 to your computer and use it in GitHub Desktop.
Save ewilde/4608673 to your computer and use it in GitHub Desktop.
How to test #structuremap configuration using #mspec
[Subject(typeof (CommonRegistry))]
public class When_add_common_registry_to_a_container
{
Because of = () => ObjectFactory.Configure(x=>x.Scan(scanner=>
{
scanner.AssemblyContainingType<ISerializer>();
scanner.LookForRegistries();
}));
It should_register_a_default_i_serializer = () => ObjectFactory.GetAllInstances<ISerializer>().Count.ShouldBeGreaterThan(0);
It should_regisiter_serializer_as_singleton =
() =>
ObjectFactory.Model.PluginTypes.First(item => item.PluginType.UnderlyingSystemType == typeof (ISerializer))
.Lifecycle.ShouldEqual(StructureMapConstants.Singleton);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment