public void Test_SaveTruckDriver_Return_ListAllTruckDrivers_When_StaffId_Not_Equal_Zero()
        {
            // Arrange
            var truckDriver = MockTruckDriver();

            truckDriver.TruckDriverId = 1;

            var truckDriverRepository = new Mock <ITruckDriverRepository>();

            truckDriverRepository.Setup(e => e.UpdateTruckDriver(truckDriver)).Returns(true);
            var controller = new TruckDriverController(truckDriverRepository.Object);

            // Act
            var result           = controller.SaveTruckDriver(truckDriver) as RedirectToRouteResult;
            var redirectViewName = result.RouteValues["Action"];

            // Assert
            Assert.AreEqual(redirectViewName, "ListAllTruckDrivers");
        }
        public void Test_SaveTruckDriver_Return_TruckDriverModel_When_ModelState_Is_Not_Valid()
        {
            // Arrange
            var truckDriver = MockTruckDriver();

            truckDriver.TruckDriverFullname = null;

            var truckDriverRepository = new Mock <ITruckDriverRepository>();
            var controller            = new TruckDriverController(truckDriverRepository.Object);

            controller.ModelState.AddModelError("fakeError", "");

            // Act
            var result    = controller.SaveTruckDriver(truckDriver) as ViewResult;
            var modelView = result.Model as TruckDriver;

            // Assert
            Assert.IsNotNull(modelView);
        }