public void InternalForm() { var viewModel = new ProcedureAndScoringViewModel { Procedure = 2, InternalForm = 1, }; var result = validator.TestValidate(viewModel); result.ShouldNotHaveValidationErrorFor(vm => vm.InternalForm); viewModel.InternalForm = 0; result = validator.TestValidate(viewModel); result.ShouldHaveValidationErrorFor(vm => vm.InternalForm); viewModel.InternalForm = 6; result = validator.TestValidate(viewModel); result.ShouldHaveValidationErrorFor(vm => vm.InternalForm); viewModel.InternalForm = 4; result = validator.TestValidate(viewModel); result.ShouldNotHaveValidationErrorFor(vm => vm.InternalForm); viewModel.Procedure = 1; viewModel.InternalForm = 0; result = validator.TestValidate(viewModel); result.ShouldNotHaveValidationErrorFor(vm => vm.InternalForm); }
public async Task SaveBladeTest() { /// from here we could create functional tests that go all the way to DB /// Or inject Mocked services or repositories to unit test var sut = new ProcedureAndScoringViewModel(new CaseServices(new MockCaseRepositry())); sut.Procedure = (int)Procedure.Acceptance; await sut.SaveBladeAsync(); Assert.AreEqual(true, sut.CaseServices.IAmWorking); }