public void GetServicesReturnsRegisteredServices()
        {
            var builder = new ContainerBuilder();
            builder.Register(c => new object()).InstancePerRequest();
            builder.Register(c => new object()).InstancePerRequest();
            var lifetimeScope = builder.Build().BeginLifetimeScope(MatchingScopeLifetimeTags.RequestLifetimeScopeTag);
            var resolver = new AutofacWebApiDependencyScope(lifetimeScope);

            var services = resolver.GetServices(typeof(object));

            Assert.That(services.Count(), Is.EqualTo(2));
        }
        public void GetServicesReturnsEmptyEnumerableForUnregisteredService()
        {
            var lifetimeScope = new ContainerBuilder().Build().BeginLifetimeScope(MatchingScopeLifetimeTags.RequestLifetimeScopeTag);
            var dependencyScope = new AutofacWebApiDependencyScope(lifetimeScope);

            var services = dependencyScope.GetServices(typeof(object));

            Assert.That(services.Count(), Is.EqualTo(0));
        }
        public void GetServicesReturnsRegisteredService()
        {
            var builder = new ContainerBuilder();
            builder.Register(c => new object()).InstancePerApiRequest();
            var lifetimeScope = builder.Build().BeginLifetimeScope(AutofacWebApiDependencyResolver.ApiRequestTag);
            var dependencyScope = new AutofacWebApiDependencyScope(lifetimeScope);

            var services = dependencyScope.GetServices(typeof(object));

            Assert.That(services.Count(), Is.EqualTo(1));
        }