public void EditFailTest() { var babyDiaperRewetService = MockHelperLaborControllerService.GetBabyDiaperRewetService(new BabyDiaperRewetEditViewModel()); var controller = new BabyDiaperRewetController(new NLogLoggerFactory()) { BabyDiaperRewetService = babyDiaperRewetService }; var result = controller.Edit(); Assert.IsType(typeof(HttpNotFoundResult), result); }
public void EditReturnsCorrectViewTest() { var viewModel = new BabyDiaperRewetEditViewModel { TestValueId = -1, TestSheetId = 5 }; var babyDiaperRewetService = MockHelperLaborControllerService.GetBabyDiaperRewetService(viewModel); var controller = new BabyDiaperRewetController(new NLogLoggerFactory()) { BabyDiaperRewetService = babyDiaperRewetService }; var result = controller.Edit(5) as ViewResult; Assert.Equal("Edit", result?.ViewName); }
public void EditTest() { var viewModel = new BabyDiaperRewetEditViewModel { TestValueId = -1, TestSheetId = 5 }; var babyDiaperRewetService = MockHelperLaborControllerService.GetBabyDiaperRewetService(viewModel); var controller = new BabyDiaperRewetController(new NLogLoggerFactory()) { BabyDiaperRewetService = babyDiaperRewetService }; var result = controller.Edit(5) as ViewResult; var newViewModel = (BabyDiaperRewetEditViewModel)result?.ViewData.Model; Assert.Equal(viewModel, newViewModel); }