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