Пример #1
0
        public void PostEditNotNullEmployee_WithoutSicknessesAndCalendarItems_false()
        {
            //Arrange
            SickController controller = new SickController(mock.Object);

            //Act
            int    id       = 17;
            string oldfrom  = "01.01.2013";
            string oldto    = "01.01.2013";
            string from     = "03.03.2013";
            string to       = "04.04.2013";
            string type     = "SickAbsence";
            string sickness = "";

            bool result = controller.Edit(id, oldfrom, oldto, from, to, type, sickness);

            //Assert
            Assert.IsFalse(result);
        }
Пример #2
0
        public void PostEditNotNullEmpCorrectDatesBadType_false()
        {
            //Arrange
            SickController controller = new SickController(mock.Object);

            //Act
            int    id       = 1;
            string oldfrom  = "01.01.2013";
            string oldto    = "01.01.2013";
            string from     = "03.03.2013";
            string to       = "04.04.2013";
            string type     = "Bad Type";
            string sickness = "";

            bool result = controller.Edit(id, oldfrom, oldto, from, to, type, sickness);

            //Assert
            Assert.IsFalse(result);
        }
Пример #3
0
        public void PostEditNotNullEmployeeBadDates_false()
        {
            //Arrange
            SickController controller = new SickController(mock.Object);

            //Act
            int    id       = 1;
            string oldFrom  = "";
            string oldTo    = "";
            string from     = "";
            string to       = "";
            string type     = "SickAbsence";
            string sickness = "";

            bool result = controller.Edit(id, oldFrom, oldTo, from, to, type, sickness);

            //Assert
            Assert.IsFalse(result);
        }
Пример #4
0
        public void PostEditNullEmployee_false()
        {
            //Arrange
            SickController controller = new SickController(mock.Object);

            //Act
            int    id       = 0;
            string oldfrom  = "28.02.2013";
            string oldto    = "28.02.2013";
            string from     = "01.04.2014";
            string to       = "10.04.2014";
            string type     = "SickAbsence";
            string sickness = "GRZ";

            bool result = controller.Edit(id, oldfrom, oldto, from, to, type, sickness);

            //Assert
            Assert.IsFalse(result);
        }
Пример #5
0
        public void PostEditSick_ValidSick_true()
        {
            //Arrange
            SickController controller = new SickController(mock.Object);

            int    id      = 4;
            string oldFrom = "24.04.2014";
            string oldTo   = "28.04.2014";

            string from = "24.06.2014";
            string to   = "28.06.2014";

            string type     = "SickAbsence";
            string sickness = "GRZ";

            //Act
            var result = controller.Edit(id, oldFrom, oldTo, from, to, type, sickness);

            //Assert
            mock.Verify(o => o.SaveSick(It.IsAny <Sickness>()), Times.Once);
            Assert.IsTrue(result);
        }