Пример #1
0
        public void Bootstrapper_Should_Add_Toolbox_To_IoC_IfServiceIsRegistered()
        {
            BootstrappingContext bootstrappContext = null;
            var iocServiceMock = new Mock <IBootstrapperService>();

            iocServiceMock
            .Setup(m => m.ServiceType).Returns(BootstrapperServiceType.IoC);
            iocServiceMock
            .Setup(m => m.BootstrappAction)
            .Returns((c) => bootstrappContext = c);

            var b = new Bootstrapper();

            b.AddService(iocServiceMock.Object);

            b.Bootstrapp();

            b.IoCRegistrations.Where(r => r.AbstractionTypes.Any(t => t == typeof(CQELightToolbox))).Should().HaveCount(1);
        }
Пример #2
0
        public void Bootstrapper_Bootstrapp_BootstrappingContext_CheckIoCRegistrations()
        {
            BootstrappingContext bootstrappContext = null;
            var iocServiceMock = new Mock <IBootstrapperService>();

            iocServiceMock
            .Setup(m => m.ServiceType).Returns(BootstrapperServiceType.IoC);
            iocServiceMock
            .Setup(m => m.BootstrappAction)
            .Returns((c) => bootstrappContext = c);

            var b = new Bootstrapper();

            b.AddService(iocServiceMock.Object);
            b.AddIoCRegistration(new TypeRegistration(typeof(object), typeof(object), typeof(DateTime)));
            b.Bootstrapp();

            bootstrappContext.Should().NotBeNull();
            bootstrappContext.IsAbstractionRegisteredInIoC(typeof(object)).Should().BeTrue();
            bootstrappContext.IsAbstractionRegisteredInIoC(typeof(DateTime)).Should().BeTrue();
        }
Пример #3
0
        public void Bootstrapper_Bootstrapp_BootstrappingContext_Services()
        {
            BootstrappingContext bootstrappContext = null;
            var iocServiceMock = new Mock <IBootstrapperService>();

            iocServiceMock
            .Setup(m => m.ServiceType).Returns(BootstrapperServiceType.IoC);
            iocServiceMock
            .Setup(m => m.BootstrappAction)
            .Returns((c) => bootstrappContext = c);

            var b = new Bootstrapper();

            b.AddService(iocServiceMock.Object);
            b.Bootstrapp();

            bootstrappContext.Should().NotBeNull();
            bootstrappContext.IsServiceRegistered(BootstrapperServiceType.IoC).Should().BeTrue();
            bootstrappContext.IsServiceRegistered(BootstrapperServiceType.Bus).Should().BeFalse();
            bootstrappContext.IsServiceRegistered(BootstrapperServiceType.DAL).Should().BeFalse();
            bootstrappContext.IsServiceRegistered(BootstrapperServiceType.EventStore).Should().BeFalse();
        }