예제 #1
0
        public void Dispose_IsImplemented_AsNoOp()
        {
            var resolver = new WebApiDependencyResolver(Container);

            resolver.Dispose();
            resolver.ShouldNotBeNull();
        }
예제 #2
0
        public void BeginScope_ReturnsSameInstanceOfResolver()
        {
            var resolver = new WebApiDependencyResolver(Container);
            var scope    = resolver.BeginScope();

            scope.ShouldEqual(resolver);
        }
예제 #3
0
        public void GetService_ReturnsInstanceOfService()
        {
            var resolver = new WebApiDependencyResolver(Container);
            var service  = resolver.GetService(typeof(IServiceProvider));

            service.ShouldEqual(Container);
        }
 public void GetServices_ReturnsInstancesOfService()
 {
     var container = new Container();
     container.RegisterAll<IFakeMultipleServices>(typeof(FakeMultipleService1), typeof(FakeMultipleService2), typeof(FakeMultipleService3));
     container.Verify();
     var resolver = new WebApiDependencyResolver(container);
     var services = resolver.GetServices(typeof(IFakeMultipleServices)).ToArray();
     services.ShouldNotBeNull();
     services.Length.ShouldEqual(3);
     var serviceTypes = services.Select(x => x.GetType()).ToArray();
     serviceTypes.ShouldContain(typeof(FakeMultipleService1));
     serviceTypes.ShouldContain(typeof(FakeMultipleService2));
     serviceTypes.ShouldContain(typeof(FakeMultipleService3));
 }
예제 #5
0
        public void GetServices_ReturnsInstancesOfService()
        {
            var container = new Container();

            container.RegisterAll <IFakeMultipleServices>(typeof(FakeMultipleService1), typeof(FakeMultipleService2), typeof(FakeMultipleService3));
            container.Verify();
            var resolver = new WebApiDependencyResolver(container);
            var services = resolver.GetServices(typeof(IFakeMultipleServices)).ToArray();

            services.ShouldNotBeNull();
            services.Length.ShouldEqual(3);
            var serviceTypes = services.Select(x => x.GetType()).ToArray();

            serviceTypes.ShouldContain(typeof(FakeMultipleService1));
            serviceTypes.ShouldContain(typeof(FakeMultipleService2));
            serviceTypes.ShouldContain(typeof(FakeMultipleService3));
        }
 public void Dispose_IsImplemented_AsNoOp()
 {
     var resolver = new WebApiDependencyResolver(Container);
     resolver.Dispose();
     resolver.ShouldNotBeNull();
 }
 public void BeginScope_ReturnsSameInstanceOfResolver()
 {
     var resolver = new WebApiDependencyResolver(Container);
     var scope = resolver.BeginScope();
     scope.ShouldEqual(resolver);
 }
 public void GetService_ReturnsInstanceOfService()
 {
     var resolver = new WebApiDependencyResolver(Container);
     var service = resolver.GetService(typeof(IServiceProvider));
     service.ShouldEqual(Container);
 }