public void GetServiceReturnsNullForUnregisteredService() { var container = new ContainerBuilder().Build(); var resolver = new AutofacDependencyResolver(container); var service = resolver.GetService(typeof(object)); Assert.That(service, Is.Null); }
public void CanOverrideDefaultServices() { var builder = new ContainerBuilder(); var messageBus = new Mock<IMessageBus>().Object; builder.RegisterInstance(messageBus); var resolver = new AutofacDependencyResolver(builder.Build()); var service = resolver.GetService(typeof(IMessageBus)); Assert.That(service, Is.SameAs(messageBus)); }
public void CanResolveDefaultServices() { var container = new ContainerBuilder().Build(); var resolver = new AutofacDependencyResolver(container); var service = resolver.GetService(typeof(IMessageBus)); Assert.That(service, Is.InstanceOf<IMessageBus>()); }