/// <summary>
        /// Tests the fact that the ISimpleServiceContainer set as parameter is conform to the way the interface should be used.
        /// </summary>
        /// <typeparam name="T">the service implemented by the servicecontainer's baseprovider </typeparam>
        /// <param name="container">the ISimpleServiceContainer implementation to test</param>
        /// <param name="baseProviderServiceToTest"></param>
        public void IServiceContainerConformanceTest <T>(ISimpleServiceContainer container, ISimpleServiceContainer baseProvider, T baseProviderServiceToTest)
        {
            Func <IAddService> creatorFunc = () => new AddServiceImpl();

            IServiceContainerCoAndContravariance(container, creatorFunc);

            IServiceContainerConformanceAddRemove(container, creatorFunc);

            IServiceContainerConformanceAddFailsWhenExisting(container, creatorFunc);

            IServiceContainerConformanceRemoveRecursive(container);

            container.Add <IAddService>(creatorFunc);
            container.Add <ISubstractService>(new SubstractServiceImpl());

            IAddService service = container.GetService <IAddService>();

            service.Should().NotBeNull();
            service.GetType().Should().Be(typeof(AddServiceImpl));
            service.Add(1, 1).Should().Be(2);

            ISubstractService substractService = container.GetService <ISubstractService>();

            substractService.Should().NotBeNull();
            substractService.GetType().Should().Be(typeof(SubstractServiceImpl));
            substractService.Substract(1, 1).Should().Be(0);

            //clear test
            container.Clear();

            container.GetService <IAddService>().Should().BeNull();
            container.GetService <ISubstractService>().Should().BeNull();

            //base provider test
            if (baseProvider != null && baseProviderServiceToTest != null)
            {
                T baseService = container.GetService <T>();
                baseService.Should().NotBeNull("The baseProvider contains the specified service.");

                container.Remove(typeof(T));
                baseService = container.GetService <T>();
                baseService.Should().NotBeNull("Trying to remove a base service from a child provider does nothing.");

                container.AddDisabled(typeof(T));
                container.GetService <T>().Should().BeNull("Access to this service is disabled");

                baseProvider.Remove(typeof(T));
                container.GetService <T>().Should().BeNull("Access to this service is disabled & The service doesn't exist anymore on the baseProvider");

                container.Remove(typeof(T));
                container.GetService <T>().Should().BeNull("The service doesn't exist anymore on the baseProvider");

                baseProvider.Add(baseProviderServiceToTest);
                container.GetService <T>().Should().NotBeNull("Back to the beginning's state, the service is retrieved from the base provider.");
            }
        }
        public void removing_a_registered_service()
        {
            int removedServicesCount = 0;

            SimpleServiceContainer container = new SimpleServiceContainer();

            container.Add(typeof(IAddService), new AddServiceImpl(), o => removedServicesCount++);

            IAddService service = container.GetService <IAddService>();

            service.Should().BeOfType <AddServiceImpl>();

            removedServicesCount.Should().Be(0);
            container.Remove(typeof(IAddService));
            removedServicesCount.Should().Be(1);

            container.GetService(typeof(IAddService)).Should().BeNull();
            container.GetService <IAddService>().Should().BeNull();
            container.Invoking(sut => sut.GetService <IAddService>(true)).Should().Throw <Exception>();
        }