public void StructureMapResolver_should_not_resolve_unregistered_ContactRepository() { var resolver = new StructureMapResolver(new Container()); var instance = resolver.GetService(typeof(IContactRepository)); Assert.IsNull(instance); }
public void StructureMapResolver_should_resolve_registered_ContactRepository() { var resolver = new StructureMapResolver(new Container(x => x.For <IContactRepository>().Use <InMemoryContactRepository>() )); var instance = resolver.GetService(typeof(IContactRepository)); Assert.IsNotNull(instance); }
public void StructureMapResolver_should_resolve_registered_ContactRepository() { var resolver = new StructureMapResolver(new Container(x => x.For<IContactRepository>().Use<InMemoryContactRepository>() )); var instance = resolver.GetService(typeof(IContactRepository)); Assert.IsNotNull(instance); }
public void StructureMapResolver_should_throw_when_attempting_to_get_service_after_being_disposed() { var mockContainer = new Mock <IContainer>(); var resolver = new StructureMapResolver(mockContainer.Object); resolver.Dispose(); Assert.That(() => resolver.GetService(typeof(IContactRepository)), Throws.Exception.TypeOf <ObjectDisposedException>()); }
public void StructureMapResolver_should_throw_when_attempting_to_get_service_after_being_disposed() { var mockContainer = new Mock<IContainer>(); var resolver = new StructureMapResolver(mockContainer.Object); resolver.Dispose(); Assert.That(() => resolver.GetService(typeof (IContactRepository)), Throws.Exception.TypeOf<ObjectDisposedException>()); }