Exemple #1
0
        public void registering_an_implementation()
        {
            int removedServicesCount = 0;

            IServiceContainerConformanceTest(new SimpleServiceContainer());

            ISimpleServiceContainer baseProvider = new SimpleServiceContainer();
            IMultService            multService  = new MultServiceImpl();

            Assert.That(multService.Mult(3, 7), Is.EqualTo(21));
            baseProvider.Add(typeof(IMultService), multService, o => removedServicesCount++);
            ISimpleServiceContainer container = new SimpleServiceContainer(baseProvider);

            IServiceContainerConformanceTest(container, baseProvider, baseProvider.GetService <IMultService>());

            Assert.That(removedServicesCount, Is.EqualTo(1));
        }
        public void registering_an_implementation()
        {
            int removedServicesCount = 0;

            IServiceContainerConformanceTest(new SimpleServiceContainer());

            ISimpleServiceContainer baseProvider = new SimpleServiceContainer();
            IMultService            multService  = new MultServiceImpl();

            multService.Mult(3, 7).Should().Be(21);
            baseProvider.Add(typeof(IMultService), multService, o => removedServicesCount++);
            ISimpleServiceContainer container = new SimpleServiceContainer(baseProvider);

            IServiceContainerConformanceTest(container, baseProvider, baseProvider.GetService <IMultService>());

            removedServicesCount.Should().Be(1);
        }