示例#1
0
        public void GetAverage_GetAverageUsingMachineId_ReturnTrue()
        {
            Machine machine = new Machine()
            {
                MachineId   = "IDX147",
                MachineName = "Machine147"
            };
            MachineManager machineMgr = new MachineManager();

            machineMgr.CreateMachine(machine: machine);
            machineMgr.AddUnits(120, machine.MachineId);
            machineMgr.AddUnits(150, machine.MachineId);
            int?avg = machineMgr.GetAverage(machine.MachineId);

            Assert.IsTrue(avg != null && avg == 135);
        }
示例#2
0
        public void AddUnits_VerifyTotalUnitsUpdate_ReturnTrue()
        {
            Machine machine = new Machine()
            {
                MachineId   = "IDX147",
                MachineName = "Machine147"
            };
            MachineManager machineMgr = new MachineManager();

            machineMgr.CreateMachine(machine: machine);
            machineMgr.AddUnits(units: 150, machineId: "IDX147");
            Assert.IsNotNull(machineMgr.Machines.FirstOrDefault(x => x.MachineId == "IDX147"));
            Assert.IsNotNull(anObject: machineMgr.Machines.FirstOrDefault(predicate: m => m.TotalUnits == 150));
            machineMgr.AddUnits(units: 10, machineId: "IDX147");
            Assert.IsTrue(condition: machineMgr.Machines.FirstOrDefault(m => m.MachineId == "IDX147").TotalUnits == 160);
        }
示例#3
0
        public void GetTotal_GetTotalUsingMachineId_ReturnTrue()
        {
            Machine machine = new Machine()
            {
                MachineId   = "IDX147",
                MachineName = "Machine147"
            };
            MachineManager machineMgr = new MachineManager();

            machineMgr.CreateMachine(machine: machine);
            machineMgr.AddUnits(120, machine.MachineId);
            int?total = machineMgr.GetTotal(machine.MachineId);

            Assert.IsTrue(total != null && total == 120);
        }