public void FactoryCanCreateDomainService()
        {
            var builder = new ContainerBuilder();
            builder.RegisterType<FakeDomainService>();

            var containerProvider = new TestContainerProvider(builder.Build());
            var factory = new AutofacDomainServiceFactory(containerProvider);
            var service = factory.CreateDomainService(typeof(FakeDomainService), null);

            Assert.IsInstanceOf<FakeDomainService>(service);
        }
        public void FactoryCanDisposeDomainService()
        {
            var builder = new ContainerBuilder();
            builder.RegisterType<FakeDomainService>();
            FakeDomainService service;
            var containerProvider = new TestContainerProvider(builder.Build());
            var factory = new AutofacDomainServiceFactory(containerProvider);
            service = (FakeDomainService)factory.CreateDomainService(typeof(FakeDomainService), null);
            factory.ReleaseDomainService(service);
            Assert.IsFalse(service.IsDisposed);

            containerProvider.EndRequestLifetime();
            Assert.IsTrue(service.IsDisposed);
        }