public async Task VacationCreateForExistingEmployee()
        {
            VacationController controller = DependencyResolver.Current.GetService <VacationController>();
            VacationDto        dto        = new VacationDto
            {
                EmployeeFirstName = "First1",
                EmployeeLastName  = "Last1",
                DateFrom          = new DateTime(2018, 6, 4),
                DateTo            = new DateTime(2018, 6, 7),
                VacationType      = VacationTypeKind.VacationLeave,
            };
            ActionResult result = await controller.Create(dto);

            Assert.IsTrue(result is RedirectToRouteResult);
        }
Exemplo n.º 2
0
        public void PostCreateVacationNotNullEmployeePaidVacation_true()
        {
            //Arrange
            VacationController controller = new VacationController(mock.Object);

            //Act
            int    id       = 1;
            string fromDate = "01.01.2014";
            string toDate   = "15.01.2014";
            string type     = "Paid Vacation";

            bool result = controller.Create(id, fromDate, toDate, type);

            //Assert
            Assert.IsTrue(result);
        }
Exemplo n.º 3
0
        public void PostCreateVacationNotNullEmployeeBadTypeCorrectDate_false()
        {
            //Arrange
            VacationController controller = new VacationController(mock.Object);

            //Act
            int    id       = 1;
            string fromDate = "01.01.2014";
            string toDate   = "15.01.2014";
            string type     = "Bad Type";

            bool result = controller.Create(id, fromDate, toDate, type);

            //Assert
            Assert.IsFalse(result);
        }
Exemplo n.º 4
0
        public void PostCreateVacationNotNullEmployeeUnpaidVacation_true()
        {
            //Arrange
            VacationController controller = new VacationController(mock.Object);
            Vacation           vacation   = new Vacation {
                EmployeeID = 1, From = new DateTime(2014, 02, 10), To = new DateTime(2014, 02, 15), Type = VacationType.UnpaidVacation
            };

            //Act
            int    id       = 1;
            string fromDate = "10.02.2014";
            string toDate   = "15.02.2014";
            string type     = "Unpaid Vacation";

            bool result = controller.Create(id, fromDate, toDate, type);

            //Assert
            Assert.IsTrue(result);
        }
Exemplo n.º 5
0
        public void PostCreateVacationNotNullEmployeeBadTypeBadDate_false()
        {
            //Arrange
            VacationController controller = new VacationController(mock.Object);
            Vacation           vacation   = new Vacation {
                EmployeeID = 0
            };

            //Act
            int    id       = 1;
            string fromDate = "";
            string toDate   = "";
            string type     = "Bad Type";

            bool result = controller.Create(id, fromDate, toDate, type);

            //Assert
            Assert.IsFalse(result);
            mock.Verify(m => m.SaveVacation(vacation), Times.Never);
        }