Ejemplo n.º 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((ConfigurationEntity)null);

            (await ctrl.GetDefault()).Should().Be(-1);
        }
Ejemplo n.º 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 ConfigurationEntity {
                Value = "14"
            });
            int dm = await ctrl.GetDefault();

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