public void UpdateRewetTestBaseTest() { var viewModel = new InkoRewetEditViewModel { TestPerson = "Hans", TestValueId = -1, TestSheetId = 1, ProductionCodeTime = new TimeSpan(12, 34, 0), ProductionCodeDay = 123, FPDry = 20.0, FPWet = 20.2, Notes = new List <TestNote> { new TestNote { ErrorCodeId = 1, Id = 1, Message = "Testnote" } } }; var testValueReturnedFromDb = new TestValue { TestSheetId = 1, CreatedDateTime = new DateTime(2016, 1, 2), LastEditedDateTime = new DateTime(2016, 1, 2), CreatedPerson = "Fritz", LastEditedPerson = "Fritz", DayInYearOfArticleCreation = 123, ArticleTestType = ArticleType.IncontinencePad, TestValueNote = new List <TestValueNote> { new TestValueNote { ErrorId = 1, Message = "Testnote" } }, IncontinencePadTestValue = new IncontinencePadTestValue { IncontinencePadTime = new TimeSpan(11, 11, 0), TestType = TestTypeIncontinencePad.RewetFree } }; var testSheetDataFromDb = GetTestSheetTestData(); var productionOrderDataFromDb = GetProductionOrderTestData(); var babyDiaperBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, testValueReturnedFromDb); var testServiceHelper = MockHelperTestServiceHelper.GetTestServiceHelperForUpdating(); var target = new InkoRewetServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperBll, TestServiceHelper = testServiceHelper }; var actual = target.UpdateRewetTest(viewModel); Assert.Equal(testValueReturnedFromDb, actual); Assert.Equal(20, actual.IncontinencePadTestValue.RewetFreeDryValue); Assert.Equal(20.2, actual.IncontinencePadTestValue.RewetFreeWetValue); Assert.Equal(0.2, actual.IncontinencePadTestValue.RewetFreeDifference, 2); Assert.Equal("Hans", actual.LastEditedPerson); Assert.Equal("Fritz", actual.CreatedPerson); Assert.NotEqual(new DateTime(2016, 1, 2), actual.LastEditedDateTime); }
public void UpdateRewetTestFailTest() { var testBll = MockHelperBll.GetTestBllForSavingAndUpdating(null, null, null); var target = new InkoRewetServiceHelper(new NLogLoggerFactory()) { TestBll = testBll }; var actual = target.UpdateRewetTest(new InkoRewetEditViewModel()); Assert.Equal(null, actual); }