This implementation of IServiceBehavior is used by Whipped Cream to allow for dependency injection when creating service hosts.
Inheritance: IServiceBehavior
        public void ApplyDispatchBehavior_AppliesCorrectInstanceProvider()
        {
            Mock<IUnityContainer> containerMock = new Mock<IUnityContainer>();
            DataServiceDependencyInstanceProvider expectedResult = new DataServiceDependencyInstanceProvider(containerMock.Object, typeof(int));
            containerMock.Setup(a => a.Resolve(typeof(DataServiceDependencyInstanceProvider), null, It.IsAny<ResolverOverride[]>())).Returns(expectedResult);
            System.ServiceModel.Description.IServiceBehavior target = new DataServiceDependencyBehavior(containerMock.Object);
            var host = new DummyServiceHost();
            var serviceDescription = new System.ServiceModel.Description.ServiceDescription();
            serviceDescription.ServiceType = typeof(int);

            target.ApplyDispatchBehavior(serviceDescription, host);

            foreach (var cd in host.ChannelDispatchers)
            {
                foreach (var ep in (cd as DummyChannelDispatcher).Endpoints)
                {
                    var instanceProvider = (host.ChannelDispatchers[0] as DummyChannelDispatcher).Endpoints[0].DispatchRuntime.InstanceProvider;

                    Assert.IsNotNull(instanceProvider, @"
            The instanceProvider should not be null because the behavior should have set it up.
            ");
                    Assert.AreEqual(expectedResult, instanceProvider, @"
            The instance provider is an instance of an object that wasn't expected.
            ");
                }
            }
        }
        public void Constructor_ContainerSet()
        {
            IUnityContainer container = Mock.Of<IUnityContainer>();
            var target = new DataServiceDependencyBehavior(container);

            Assert.AreEqual(container, target.Container, @"
            The Container property was not set during construction.
            ");
        }