public void Test_CreateJobAssignment_Return_ListAllTransportationInfsView_When_ModelState_Is__Valid_And_Repo_Equal_True()
        {
            //Arrage
            var transportationInf = MockViewModelData();

            transportationInf.JobAssignment.DestinationJob = null;
            var mockTruckDriver = new Mock <ITruckDriverRepository>();
            var mockJob         = new Mock <IJobAssignmentRepository>();

            mockJob.Setup(m => m.AddJobAssignment(transportationInf)).Returns(true);

            var mockTrans  = new Mock <ITransportationInfRepository>();
            var controller = new TransportationInfController(mockTrans.Object, mockJob.Object, mockTruckDriver.Object);

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

            // Assert
            Assert.AreEqual(redirectViewName, "ListAllTransportationInfs");
        }
        public void Test_CreateJobAssignment_Return_JobAssignmentViewModel_And_FormCreateJobAssignmentView_When_ModelState_Is_Not_Valid()
        {
            //Arrage
            var transportationInf = MockViewModelData();

            transportationInf.JobAssignment.DestinationJob = null;
            var mockTruckDriver = new Mock <ITruckDriverRepository>();
            var mockJob         = new Mock <IJobAssignmentRepository>();

            mockJob.Setup(m => m.AddJobAssignment(transportationInf)).Returns(true);

            var mockTrans  = new Mock <ITransportationInfRepository>();
            var controller = new TransportationInfController(mockTrans.Object, mockJob.Object, mockTruckDriver.Object);

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

            // Act
            var result   = controller.CreateJobAssignment(transportationInf) as ViewResult;
            var viewName = result.ViewName;

            // Assert
            Assert.AreEqual(viewName, "FormCreateJobAssignment");
        }