コード例 #1
0
        public async Task GetDefaultMachineNotSet()
        {
            var unitOfWork = Substitute.For <IUnitOfWork>();
            var rep        = Substitute.For <IMachineRepository>();
            var repC       = Substitute.For <IConfigurationRepository>();

            var ctrl = new MachineManager(unitOfWork, rep, repC, new CNCLibUserContext(), Mapper);

            repC.Get(1, "Environment", "DefaultMachineId").Returns((Configuration)null);

            (await ctrl.GetDefaultMachine()).Should().Be(-1);
        }
コード例 #2
0
        public async Task GetDefaultMachine()
        {
            var unitOfWork = Substitute.For <IUnitOfWork>();
            var rep        = Substitute.For <IMachineRepository>();
            var repC       = Substitute.For <IConfigurationRepository>();

            var ctrl = new MachineManager(unitOfWork, rep, repC, new CNCLibUserContext(), Mapper);

            repC.Get(1, "Environment", "DefaultMachineId").Returns(new Configuration {
                Value = "14"
            });
            int dm = await ctrl.GetDefaultMachine();

            dm.Should().Be(14);
        }