Пример #1
0
        public void getAllShiftsTest()
        {
            ShiftsService target = new ShiftsService(dbContext); // TODO: Initialize to an appropriate value
            //Assign
            Shift expected1 = new Shift();
            expected1.ShiftID = 1;
            expected1.ShiftType = "Morning";
            dbContext.Shifts.Add(expected1);

            Shift expected2 = new Shift();
            expected2.ShiftID = 2;
            expected2.ShiftType = "Afternoon";
            dbContext.Shifts.Add(expected2);

            dbContext.SaveChanges();

            List<Shift> expected = new List<Shift>();
            expected.Add(expected1);
            expected.Add(expected2);

            //Act
            List<Shift> actual;
            actual = target.getAllShifts();

            //Assert
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0].ShiftID, actual[0].ShiftID);
            Assert.AreEqual(expected[1].ShiftID, actual[1].ShiftID);

            //Clear
            dbContext.Shifts.Remove(expected1);
            dbContext.Shifts.Remove(expected2);
        }
Пример #2
0
        public void getShiftTest()
        {
            //Assign
            ShiftsService target = new ShiftsService(dbContext); // TODO: Initialize to an appropriate value
            Shift expected = new Shift();
            expected.ShiftID = 1;
            expected.ShiftType = "Morning";
            dbContext.Shifts.Add(expected);
            dbContext.SaveChanges();

            //Act
            Shift actual;
            actual = target.getShift(expected.ShiftID);

            //Assert
            Assert.AreEqual(expected, actual);

            //Clear
            dbContext.Shifts.Remove(expected);
        }