public void UpdateRewetTestFailTest() { var babyDiaperRetentionBll = MockHelperBll.GetTestBllForSavingAndUpdating(null, null, null); var target = new BabyDiaperRewetServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperRetentionBll }; var actual = target.UpdateRewetTest(new BabyDiaperRewetEditViewModel()); Assert.Equal(null, actual); }
public void UpdateRewetTestBaseTest() { var viewModel = new BabyDiaperRewetEditViewModel { TestPerson = "Hans", TestValueId = -1, TestSheetId = 1, ProductionCodeTime = new TimeSpan(12, 34, 0), ProductionCodeDay = 123, DiaperWeight = 30.1, RewetAfter140 = 0, RewetAfter210 = 0.1, StrikeThrough = 0.3, Distribution = 250, PenetrationTime1 = 1, PenetrationTime2 = 2, PenetrationTime3 = 3, PenetrationTime4 = 4, TestType = TestTypeBabyDiaper.RewetAndPenetrationTime, Notes = new List <TestNote> { new TestNote { ErrorCodeId = 1, Id = 1, Message = "Testnote" } } }; var testValueReturnedFromDb = new TestValue { TestSheetId = 1, TestValueId = 2, CreatedDateTime = new DateTime(2016, 1, 2), LastEditedDateTime = new DateTime(2016, 1, 2), CreatedPerson = "Fritz", LastEditedPerson = "Fritz", DayInYearOfArticleCreation = 123, ArticleTestType = ArticleType.BabyDiaper, TestValueNote = new List <TestValueNote> { new TestValueNote { ErrorId = 1, Message = "Testnote" } }, BabyDiaperTestValue = new BabyDiaperTestValue { DiaperCreatedTime = new TimeSpan(11, 11, 0), WeightDiaperDry = 15, TestType = TestTypeBabyDiaper.RewetAndPenetrationTime } }; var testSheetDataFromDb = GetTestSheetTestData(); var productionOrderDataFromDb = GetProductionOrderTestData(); var babyDiaperBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, testValueReturnedFromDb); var testServiceHelper = MockHelperTestServiceHelper.GetTestServiceHelperForUpdating(); var target = new BabyDiaperRewetServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperBll, TestServiceHelper = testServiceHelper }; var actual = target.UpdateRewetTest(viewModel); Assert.Equal(testValueReturnedFromDb, actual); Assert.Equal(30.1, actual.BabyDiaperTestValue.WeightDiaperDry); Assert.Equal(0.3, actual.BabyDiaperTestValue.StrikeTroughValue); Assert.Equal("Hans", actual.LastEditedPerson); Assert.Equal("Fritz", actual.CreatedPerson); Assert.NotEqual(new DateTime(2016, 1, 2), actual.LastEditedDateTime); }