public void UpdateRewetAverageAndStvNoTestsTest() { var testSheetDataFromDb = GetTestSheetTestDataWithAvgAndStDev(); var productionOrderDataFromDb = GetProductionOrderTestData(); var babyDiaperBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var target = new InkoRewetServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperBll }; var actual = target.UpdateRewetAverageAndStv(1); var actualRewetAvg = actual.TestValues.FirstOrDefault( tv => (tv.TestValueType == TestValueType.Average) && (tv.IncontinencePadTestValue.TestType == TestTypeIncontinencePad.RewetFree)); Assert.NotNull(actualRewetAvg); Assert.Equal(0, actualRewetAvg.IncontinencePadTestValue.RewetFreeDryValue); Assert.Equal(0, actualRewetAvg.IncontinencePadTestValue.RewetFreeWetValue); Assert.Equal(0, actualRewetAvg.IncontinencePadTestValue.RewetFreeDifference); Assert.Equal(RwType.Ok, actualRewetAvg.IncontinencePadTestValue.RewetFreeRw); var actualRewetStDev = actual.TestValues.FirstOrDefault( tv => (tv.TestValueType == TestValueType.StandardDeviation) && (tv.IncontinencePadTestValue.TestType == TestTypeIncontinencePad.RewetFree)); Assert.NotNull(actualRewetStDev); Assert.Equal(0, actualRewetStDev.IncontinencePadTestValue.RewetFreeDryValue); Assert.Equal(0, actualRewetStDev.IncontinencePadTestValue.RewetFreeWetValue); Assert.Equal(0, actualRewetStDev.IncontinencePadTestValue.RewetFreeDifference); }
public void SaveNewAquisitionTestCalculationRwWorseTest() { var viewModel = GetViewModelTestData(); viewModel.AquisitionAddition1 = 20.1; viewModel.AquisitionAddition2 = 60.1; viewModel.AquisitionAddition3 = 85.1; viewModel.FPWet = 25; var testValueReturnedFromHelper = GetTestValueTestData(); var testSheetDataFromDb = GetTestSheetTestData(); var productionOrderDataFromDb = GetProductionOrderTestData(); var testBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var testServiceHelper = MockHelperTestServiceHelper.GetTestServiceHelperCreateNewTestValue(testValueReturnedFromHelper); var target = new InkoAquisitionServiceHelper(new NLogLoggerFactory()) { TestBll = testBll, TestServiceHelper = testServiceHelper }; var actual = target.SaveNewAquisitionTest(viewModel); Assert.Equal(RwType.Worse, actual.IncontinencePadTestValue.AcquisitionTimeFirstRw); Assert.Equal(RwType.Worse, actual.IncontinencePadTestValue.AcquisitionTimeSecondRw); Assert.Equal(RwType.Worse, actual.IncontinencePadTestValue.AcquisitionTimeThirdRw); Assert.Equal(RwType.Worse, actual.IncontinencePadTestValue.RewetAfterAcquisitionTimeRw); }
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 UpdateRewetAverageAndStvNoTestsTest() { var testSheetDataFromDb = GetTestSheetTestDataWithAvgAndStDev(); var productionOrderDataFromDb = GetProductionOrderTestData(); var babyDiaperBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var target = new BabyDiaperRewetServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperBll }; var actual = target.UpdateRewetAverageAndStv(1); var actualRewetAvg = actual.TestValues.FirstOrDefault(tv => (tv.TestValueType == TestValueType.Average) && (tv.BabyDiaperTestValue.TestType == TestTypeBabyDiaper.Rewet)); Assert.NotNull(actualRewetAvg); Assert.Equal(0, actualRewetAvg.BabyDiaperTestValue.WeightDiaperDry); Assert.Equal(0, actualRewetAvg.BabyDiaperTestValue.Rewet140Value); Assert.Equal(0, actualRewetAvg.BabyDiaperTestValue.Rewet210Value); Assert.Equal(0, actualRewetAvg.BabyDiaperTestValue.StrikeTroughValue); Assert.Equal(0, actualRewetAvg.BabyDiaperTestValue.DistributionOfTheStrikeTrough); Assert.Equal(RwType.Ok, actualRewetAvg.BabyDiaperTestValue.Rewet140Rw); Assert.Equal(RwType.Ok, actualRewetAvg.BabyDiaperTestValue.Rewet210Rw); var actualRewetStDev = actual.TestValues.FirstOrDefault(tv => (tv.TestValueType == TestValueType.StandardDeviation) && (tv.BabyDiaperTestValue.TestType == TestTypeBabyDiaper.Rewet)); Assert.NotNull(actualRewetStDev); Assert.Equal(0, actualRewetStDev.BabyDiaperTestValue.WeightDiaperDry); Assert.Equal(0, actualRewetStDev.BabyDiaperTestValue.Rewet140Value); Assert.Equal(0, actualRewetStDev.BabyDiaperTestValue.Rewet210Value); Assert.Equal(0, actualRewetStDev.BabyDiaperTestValue.StrikeTroughValue); Assert.Equal(0, actualRewetStDev.BabyDiaperTestValue.DistributionOfTheStrikeTrough); var actualRewetAndPenetrationAvg = actual.TestValues.FirstOrDefault( tv => (tv.TestValueType == TestValueType.Average) && (tv.BabyDiaperTestValue.TestType == TestTypeBabyDiaper.RewetAndPenetrationTime)); Assert.NotNull(actualRewetAndPenetrationAvg); Assert.Equal(0, actualRewetAndPenetrationAvg.BabyDiaperTestValue.WeightDiaperDry); Assert.Equal(0, actualRewetAndPenetrationAvg.BabyDiaperTestValue.PenetrationTimeAdditionFirst); Assert.Equal(0, actualRewetAndPenetrationAvg.BabyDiaperTestValue.PenetrationTimeAdditionSecond); Assert.Equal(0, actualRewetAndPenetrationAvg.BabyDiaperTestValue.PenetrationTimeAdditionThird); Assert.Equal(0, actualRewetAndPenetrationAvg.BabyDiaperTestValue.PenetrationTimeAdditionFourth); Assert.Equal(RwType.Ok, actualRewetAndPenetrationAvg.BabyDiaperTestValue.PenetrationRwType); var actualRewetAndPenetrationStDev = actual.TestValues.FirstOrDefault( tv => (tv.TestValueType == TestValueType.StandardDeviation) && (tv.BabyDiaperTestValue.TestType == TestTypeBabyDiaper.RewetAndPenetrationTime)); Assert.NotNull(actualRewetAndPenetrationStDev); Assert.Equal(0, actualRewetAndPenetrationStDev.BabyDiaperTestValue.WeightDiaperDry); Assert.Equal(0, actualRewetAndPenetrationStDev.BabyDiaperTestValue.PenetrationTimeAdditionFirst); Assert.Equal(0, actualRewetAndPenetrationStDev.BabyDiaperTestValue.PenetrationTimeAdditionSecond); Assert.Equal(0, actualRewetAndPenetrationStDev.BabyDiaperTestValue.PenetrationTimeAdditionThird); Assert.Equal(0, actualRewetAndPenetrationStDev.BabyDiaperTestValue.PenetrationTimeAdditionFourth); }
public void UpdateRetentionAverageAndStvTwoTestsStDevTest() { var testValue1 = new TestValue { TestValueType = TestValueType.Single, ArticleTestType = ArticleType.BabyDiaper, BabyDiaperTestValue = new BabyDiaperTestValue { TestType = TestTypeBabyDiaper.Retention, WeightDiaperDry = 30, RetentionWetWeight = 400, RetentionAfterZentrifugeValue = 370, RetentionAfterZentrifugePercent = 1100, SapGHoewiValue = 10.98, RetentionRw = RwType.Ok } }; var testValue2 = new TestValue { TestValueType = TestValueType.Single, ArticleTestType = ArticleType.BabyDiaper, BabyDiaperTestValue = new BabyDiaperTestValue { TestType = TestTypeBabyDiaper.Retention, WeightDiaperDry = 31, RetentionWetWeight = 395.5, RetentionAfterZentrifugeValue = 364.5, RetentionAfterZentrifugePercent = 1200, SapGHoewiValue = 10.3, RetentionRw = RwType.Ok } }; var testSheetDataFromDb = GetTestSheetTestDataWithAvgAndStDev(); testSheetDataFromDb.TestValues.Add(testValue1); testSheetDataFromDb.TestValues.Add(testValue2); var productionOrderDataFromDb = GetProductionOrderTestData(); var babyDiaperRetentionBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var target = new BabyDiaperRetentionServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperRetentionBll }; var actual = target.UpdateRetentionAverageAndStv(1); var actualStDev = actual.TestValues.FirstOrDefault( tv => (tv.TestValueType == TestValueType.StandardDeviation) && (tv.BabyDiaperTestValue.TestType == TestTypeBabyDiaper.Retention)); Assert.NotNull(actualStDev); Assert.Equal(0.71, actualStDev.BabyDiaperTestValue.WeightDiaperDry, 2); Assert.Equal(3.18, actualStDev.BabyDiaperTestValue.RetentionWetWeight, 2); Assert.Equal(3.89, actualStDev.BabyDiaperTestValue.RetentionAfterZentrifugeValue, 2); Assert.Equal(70.71, actualStDev.BabyDiaperTestValue.RetentionAfterZentrifugePercent, 2); Assert.Equal(0.48, actualStDev.BabyDiaperTestValue.SapGHoewiValue, 2); }
public void SaveNewRewetTestCalculationRwWorseTest() { var viewModel = new BabyDiaperRewetEditViewModel { TestPerson = "Hans", TestValueId = -1, TestSheetId = 1, ProductionCodeTime = new TimeSpan(12, 34, 0), ProductionCodeDay = 123, DiaperWeight = 30.1, RewetAfter140 = 0.5, RewetAfter210 = 0.6, StrikeThrough = 0.3, Distribution = 250, PenetrationTime1 = 1, PenetrationTime2 = 2, PenetrationTime3 = 3, PenetrationTime4 = 260, TestType = TestTypeBabyDiaper.RewetAndPenetrationTime, Notes = new List <TestNote> { new TestNote { ErrorCodeId = 1, Id = 1, Message = "Testnote" } } }; var testValueReturnedFromHelper = new TestValue { TestSheetId = 1, CreatedDateTime = new DateTime(2016, 1, 2), LastEditedDateTime = new DateTime(2016, 1, 2), CreatedPerson = "Hans", LastEditedPerson = "Hans", DayInYearOfArticleCreation = 123, ArticleTestType = ArticleType.BabyDiaper, TestValueNote = new List <TestValueNote> { new TestValueNote { ErrorId = 1, Message = "Testnote" } } }; var testSheetDataFromDb = GetTestSheetTestData(); var productionOrderDataFromDb = GetProductionOrderTestData(); var babyDiaperRetentionBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var babyDiaperServiceHelper = MockHelperTestServiceHelper.GetTestServiceHelperCreateNewTestValue(testValueReturnedFromHelper); var target = new BabyDiaperRewetServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperRetentionBll, TestServiceHelper = babyDiaperServiceHelper }; var actual = target.SaveNewRewetTest(viewModel); Assert.Equal(RwType.Worse, actual.BabyDiaperTestValue.Rewet140Rw); Assert.Equal(RwType.Worse, actual.BabyDiaperTestValue.Rewet140Rw); Assert.Equal(RwType.Worse, actual.BabyDiaperTestValue.PenetrationRwType); }
public void UpdateRewetAverageAndStvOneTestStDevTest() { var onlyTestValue = new TestValue { TestValueType = TestValueType.Single, ArticleTestType = ArticleType.BabyDiaper, BabyDiaperTestValue = new BabyDiaperTestValue { TestType = TestTypeBabyDiaper.RewetAndPenetrationTime, WeightDiaperDry = 30.1, Rewet140Value = 0, Rewet210Value = 0.1, StrikeTroughValue = 0.3, DistributionOfTheStrikeTrough = 250, PenetrationTimeAdditionFirst = 1, PenetrationTimeAdditionSecond = 2, PenetrationTimeAdditionThird = 3, PenetrationTimeAdditionFourth = 4, Rewet140Rw = RwType.Ok, Rewet210Rw = RwType.Ok, PenetrationRwType = RwType.Ok } }; var testSheetDataFromDb = GetTestSheetTestDataWithAvgAndStDev(); testSheetDataFromDb.TestValues.Add(onlyTestValue); var productionOrderDataFromDb = GetProductionOrderTestData(); var babyDiaperBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var target = new BabyDiaperRewetServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperBll }; var actual = target.UpdateRewetAverageAndStv(1); var actualRewetStDev = actual.TestValues.FirstOrDefault(tv => (tv.TestValueType == TestValueType.StandardDeviation) && (tv.BabyDiaperTestValue.TestType == TestTypeBabyDiaper.Rewet)); Assert.NotNull(actualRewetStDev); Assert.Equal(0, actualRewetStDev.BabyDiaperTestValue.WeightDiaperDry); Assert.Equal(0, actualRewetStDev.BabyDiaperTestValue.Rewet140Value); Assert.Equal(0, actualRewetStDev.BabyDiaperTestValue.Rewet210Value); Assert.Equal(0, actualRewetStDev.BabyDiaperTestValue.StrikeTroughValue); Assert.Equal(0, actualRewetStDev.BabyDiaperTestValue.DistributionOfTheStrikeTrough); var actualRewetAndPenetrationAvg = actual.TestValues.FirstOrDefault( tv => (tv.TestValueType == TestValueType.StandardDeviation) && (tv.BabyDiaperTestValue.TestType == TestTypeBabyDiaper.RewetAndPenetrationTime)); Assert.NotNull(actualRewetAndPenetrationAvg); Assert.Equal(0, actualRewetAndPenetrationAvg.BabyDiaperTestValue.WeightDiaperDry); Assert.Equal(0, actualRewetAndPenetrationAvg.BabyDiaperTestValue.PenetrationTimeAdditionFirst); Assert.Equal(0, actualRewetAndPenetrationAvg.BabyDiaperTestValue.PenetrationTimeAdditionSecond); Assert.Equal(0, actualRewetAndPenetrationAvg.BabyDiaperTestValue.PenetrationTimeAdditionThird); Assert.Equal(0, actualRewetAndPenetrationAvg.BabyDiaperTestValue.PenetrationTimeAdditionFourth); }
public void UpdateRetentionAverageAndStvOneTestAvgTest() { var onlyTestValue = new TestValue { TestValueType = TestValueType.Single, ArticleTestType = ArticleType.BabyDiaper, IncontinencePadTestValue = new IncontinencePadTestValue { TestType = TestTypeIncontinencePad.Retention, RetentionWeight = 30.21, RetentionWetValue = 430.15, RetentionAfterZentrifuge = 212.11, RetentionAbsorbtion = 399.94, RetentionEndValue = 181.9, RetentionRw = RwType.Ok } }; var testSheetDataFromDb = GetTestSheetTestDataWithAvgAndStDev(); testSheetDataFromDb.TestValues.Add(onlyTestValue); var productionOrderDataFromDb = GetProductionOrderTestData(); var testBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var target = new InkoRetentionServiceHelper(new NLogLoggerFactory()) { TestBll = testBll }; var actual = target.UpdateRetentionAverageAndStv(1); var actualRetentionAvg = actual.TestValues.FirstOrDefault( tv => (tv.TestValueType == TestValueType.Average) && (tv.IncontinencePadTestValue.TestType == TestTypeIncontinencePad.Retention)); Assert.NotNull(actualRetentionAvg); Assert.Equal(30.21, actualRetentionAvg.IncontinencePadTestValue.RetentionWeight); Assert.Equal(430.15, actualRetentionAvg.IncontinencePadTestValue.RetentionWetValue); Assert.Equal(212.11, actualRetentionAvg.IncontinencePadTestValue.RetentionAfterZentrifuge); Assert.Equal(399.94, actualRetentionAvg.IncontinencePadTestValue.RetentionAbsorbtion); Assert.Equal(181.9, actualRetentionAvg.IncontinencePadTestValue.RetentionEndValue); Assert.Equal(RwType.Ok, actualRetentionAvg.IncontinencePadTestValue.RetentionRw); var actualRetentionStDev = actual.TestValues.FirstOrDefault( tv => (tv.TestValueType == TestValueType.StandardDeviation) && (tv.IncontinencePadTestValue.TestType == TestTypeIncontinencePad.Retention)); Assert.NotNull(actualRetentionStDev); Assert.Equal(0, actualRetentionStDev.IncontinencePadTestValue.RetentionWeight); Assert.Equal(0, actualRetentionStDev.IncontinencePadTestValue.RetentionWetValue); Assert.Equal(0, actualRetentionStDev.IncontinencePadTestValue.RetentionAfterZentrifuge); Assert.Equal(0, actualRetentionStDev.IncontinencePadTestValue.RetentionAbsorbtion); Assert.Equal(0, actualRetentionStDev.IncontinencePadTestValue.RetentionEndValue); }
public void UpdateRetentionTestFailTest() { var testBll = MockHelperBll.GetTestBllForSavingAndUpdating(null, null, null); var target = new InkoRetentionServiceHelper(new NLogLoggerFactory()) { TestBll = testBll }; var actual = target.UpdateRetentionTest(new InkoRetentionEditViewModel()); Assert.Equal(null, actual); }
public void SaveNewRetentionTestCalculationTest() { var viewModel = new BabyDiaperRetentionEditViewModel { TestPerson = "Hans", TestValueId = -1, TestSheetId = 1, ProductionCodeTime = new TimeSpan(12, 34, 0), ProductionCodeDay = 123, DiaperWeight = 30.1, WeightRetentionWet = 399.8, Notes = new List <TestNote> { new TestNote { ErrorCodeId = 1, Id = 1, Message = "Testnote" } } }; var testValueReturnedFromHelper = new TestValue { TestSheetId = 1, CreatedDateTime = new DateTime(2016, 1, 2), LastEditedDateTime = new DateTime(2016, 1, 2), CreatedPerson = "Hans", LastEditedPerson = "Hans", DayInYearOfArticleCreation = 123, ArticleTestType = ArticleType.BabyDiaper, TestValueNote = new List <TestValueNote> { new TestValueNote { ErrorId = 1, Message = "Testnote" } } }; var testSheetDataFromDb = GetTestSheetTestData(); var productionOrderDataFromDb = GetProductionOrderTestData(); var babyDiaperRetentionBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var babyDiaperServiceHelper = MockHelperTestServiceHelper.GetTestServiceHelperCreateNewTestValue(testValueReturnedFromHelper); var target = new BabyDiaperRetentionServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperRetentionBll, TestServiceHelper = babyDiaperServiceHelper }; var actual = target.SaveNewRetentionTest(viewModel); Assert.Equal(369.7, actual.BabyDiaperTestValue.RetentionAfterZentrifugeValue); Assert.Equal(1228.2392026578073, actual.BabyDiaperTestValue.RetentionAfterZentrifugePercent, 2); Assert.Equal("EKX", actual.BabyDiaperTestValue.SapType); Assert.Equal("EN67", actual.BabyDiaperTestValue.SapNr); Assert.Equal(10.351681957186543, actual.BabyDiaperTestValue.SapGHoewiValue, 2); }
public void SaveNewRewetTestBaseTest() { 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 testValueReturnedFromHelper = new TestValue { TestSheetId = 1, CreatedDateTime = new DateTime(2016, 1, 2), LastEditedDateTime = new DateTime(2016, 1, 2), CreatedPerson = "Hans", LastEditedPerson = "Hans", DayInYearOfArticleCreation = 123, ArticleTestType = ArticleType.IncontinencePad, TestValueNote = new List <TestValueNote> { new TestValueNote { ErrorId = 1, Message = "Testnote" } } }; var testSheetDataFromDb = GetTestSheetTestData(); var productionOrderDataFromDb = GetProductionOrderTestData(); var testBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var testServiceHelper = MockHelperTestServiceHelper.GetTestServiceHelperCreateNewTestValue(testValueReturnedFromHelper); var target = new InkoRewetServiceHelper(new NLogLoggerFactory()) { TestBll = testBll, TestServiceHelper = testServiceHelper }; var actual = target.SaveNewRewetTest(viewModel); Assert.Equal(testValueReturnedFromHelper, actual); }
public void UpdateAquisitionAverageAndStvNoTestsTest() { var testSheetDataFromDb = GetTestSheetTestDataWithAvgAndStDev(); var productionOrderDataFromDb = GetProductionOrderTestData(); var babyDiaperBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var target = new InkoAquisitionServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperBll }; var actual = target.UpdateAquisitionAverageAndStv(1); var actualAquisitionAvg = actual.TestValues.FirstOrDefault( tv => (tv.TestValueType == TestValueType.Average) && (tv.IncontinencePadTestValue.TestType == TestTypeIncontinencePad.AcquisitionTimeAndRewet)); Assert.NotNull(actualAquisitionAvg); Assert.Equal(0, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionWeight); Assert.Equal(0, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionTimeFirst); Assert.Equal(0, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionTimeSecond); Assert.Equal(0, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionTimeThird); Assert.Equal(0, actualAquisitionAvg.IncontinencePadTestValue.RewetAfterAcquisitionTimeDryWeight); Assert.Equal(0, actualAquisitionAvg.IncontinencePadTestValue.RewetAfterAcquisitionTimeWetWeight); Assert.Equal(0, actualAquisitionAvg.IncontinencePadTestValue.RewetAfterAcquisitionTimeWeightDifference); Assert.Equal(RwType.Ok, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionTimeFirstRw); Assert.Equal(RwType.Ok, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionTimeSecondRw); Assert.Equal(RwType.Ok, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionTimeThirdRw); Assert.Equal(RwType.Ok, actualAquisitionAvg.IncontinencePadTestValue.RewetAfterAcquisitionTimeRw); var actualAquisitionStDev = actual.TestValues.FirstOrDefault( tv => (tv.TestValueType == TestValueType.StandardDeviation) && (tv.IncontinencePadTestValue.TestType == TestTypeIncontinencePad.AcquisitionTimeAndRewet)); Assert.NotNull(actualAquisitionStDev); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.AcquisitionWeight); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.AcquisitionTimeFirst); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.AcquisitionTimeSecond); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.AcquisitionTimeThird); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.RewetAfterAcquisitionTimeDryWeight); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.RewetAfterAcquisitionTimeWetWeight); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.RewetAfterAcquisitionTimeWeightDifference); }
public void UpdateAquisitionTestBaseTest() { var viewModel = GetViewModelTestData(); var testValueReturnedFromDb = GetTestValueTestData(); testValueReturnedFromDb.CreatedPerson = "Fritz"; testValueReturnedFromDb.LastEditedPerson = "Fritz"; testValueReturnedFromDb.IncontinencePadTestValue = new IncontinencePadTestValue { IncontinencePadTime = new TimeSpan(11, 11, 0), TestType = TestTypeIncontinencePad.AcquisitionTimeAndRewet }; var testSheetDataFromDb = GetTestSheetTestData(); var productionOrderDataFromDb = GetProductionOrderTestData(); var babyDiaperBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, testValueReturnedFromDb); var testServiceHelper = MockHelperTestServiceHelper.GetTestServiceHelperForUpdating(); var target = new InkoAquisitionServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperBll, TestServiceHelper = testServiceHelper }; var actual = target.UpdateAquisitionTest(viewModel); Assert.Equal(testValueReturnedFromDb, actual); Assert.Equal(21.15, actual.IncontinencePadTestValue.AcquisitionWeight); Assert.Equal(17.12, actual.IncontinencePadTestValue.AcquisitionTimeFirst); Assert.Equal(54.06, actual.IncontinencePadTestValue.AcquisitionTimeSecond); Assert.Equal(67.85, actual.IncontinencePadTestValue.AcquisitionTimeThird, 2); Assert.Equal(21.73, actual.IncontinencePadTestValue.RewetAfterAcquisitionTimeDryWeight, 2); Assert.Equal(21.79, actual.IncontinencePadTestValue.RewetAfterAcquisitionTimeWetWeight, 2); Assert.Equal(0.06, actual.IncontinencePadTestValue.RewetAfterAcquisitionTimeWeightDifference, 2); Assert.Equal(RwType.Ok, actual.IncontinencePadTestValue.AcquisitionTimeFirstRw); Assert.Equal(RwType.Ok, actual.IncontinencePadTestValue.AcquisitionTimeSecondRw); Assert.Equal(RwType.Ok, actual.IncontinencePadTestValue.AcquisitionTimeThirdRw); Assert.Equal(RwType.Ok, actual.IncontinencePadTestValue.RewetAfterAcquisitionTimeRw); Assert.Equal("Hans", actual.LastEditedPerson); Assert.Equal("Fritz", actual.CreatedPerson); Assert.NotEqual(new DateTime(2016, 1, 2), actual.LastEditedDateTime); }
public void UpdateRetentionAverageAndStvOneTestAvgTest() { var onlyTestValue = new TestValue { TestValueType = TestValueType.Single, ArticleTestType = ArticleType.BabyDiaper, BabyDiaperTestValue = new BabyDiaperTestValue { TestType = TestTypeBabyDiaper.Retention, WeightDiaperDry = 30, RetentionWetWeight = 400, RetentionAfterZentrifugeValue = 370, RetentionAfterZentrifugePercent = 1100, SapGHoewiValue = 10.98, RetentionRw = RwType.Ok } }; var testSheetDataFromDb = GetTestSheetTestDataWithAvgAndStDev(); testSheetDataFromDb.TestValues.Add(onlyTestValue); var productionOrderDataFromDb = GetProductionOrderTestData(); var babyDiaperRetentionBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var target = new BabyDiaperRetentionServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperRetentionBll }; var actual = target.UpdateRetentionAverageAndStv(1); var actualAvg = actual.TestValues.FirstOrDefault(tv => (tv.TestValueType == TestValueType.Average) && (tv.BabyDiaperTestValue.TestType == TestTypeBabyDiaper.Retention)); Assert.NotNull(actualAvg); Assert.Equal(onlyTestValue.BabyDiaperTestValue.WeightDiaperDry, actualAvg.BabyDiaperTestValue.WeightDiaperDry); Assert.Equal(onlyTestValue.BabyDiaperTestValue.RetentionWetWeight, actualAvg.BabyDiaperTestValue.RetentionWetWeight); Assert.Equal(onlyTestValue.BabyDiaperTestValue.RetentionAfterZentrifugeValue, actualAvg.BabyDiaperTestValue.RetentionAfterZentrifugeValue); Assert.Equal(onlyTestValue.BabyDiaperTestValue.RetentionAfterZentrifugePercent, actualAvg.BabyDiaperTestValue.RetentionAfterZentrifugePercent); Assert.Equal(onlyTestValue.BabyDiaperTestValue.SapGHoewiValue, actualAvg.BabyDiaperTestValue.SapGHoewiValue); Assert.Equal(onlyTestValue.BabyDiaperTestValue.RetentionRw, actualAvg.BabyDiaperTestValue.RetentionRw); }
public void SaveNewRetentionTestCalculationRwOkTest() { var viewModel = GetViewModelTestData(); var testValueReturnedFromHelper = GetTestValueTestData(); var testSheetDataFromDb = GetTestSheetTestData(); var productionOrderDataFromDb = GetProductionOrderTestData(); var testBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var testServiceHelper = MockHelperTestServiceHelper.GetTestServiceHelperCreateNewTestValue(testValueReturnedFromHelper); var target = new InkoRetentionServiceHelper(new NLogLoggerFactory()) { TestBll = testBll, TestServiceHelper = testServiceHelper }; var actual = target.SaveNewRetentionTest(viewModel); Assert.Equal(RwType.Ok, actual.IncontinencePadTestValue.RetentionRw); }
public void SaveNewAquisitionTestBaseTest() { var viewModel = GetViewModelTestData(); var testValueReturnedFromHelper = GetTestValueTestData(); var testSheetDataFromDb = GetTestSheetTestData(); var productionOrderDataFromDb = GetProductionOrderTestData(); var testBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var testServiceHelper = MockHelperTestServiceHelper.GetTestServiceHelperCreateNewTestValue(testValueReturnedFromHelper); var target = new InkoAquisitionServiceHelper(new NLogLoggerFactory()) { TestBll = testBll, TestServiceHelper = testServiceHelper }; var actual = target.SaveNewAquisitionTest(viewModel); Assert.Equal(testValueReturnedFromHelper, actual); }
public void UpdateRetentionTestBaseTest() { var viewModel = GetViewModelTestData(); var testValueReturnedFromDb = GetTestValueTestData(); testValueReturnedFromDb.CreatedPerson = "Fritz"; testValueReturnedFromDb.LastEditedPerson = "Fritz"; testValueReturnedFromDb.IncontinencePadTestValue = new IncontinencePadTestValue { IncontinencePadTime = new TimeSpan(11, 11, 0), TestType = TestTypeIncontinencePad.Retention }; var testSheetDataFromDb = GetTestSheetTestData(); var productionOrderDataFromDb = GetProductionOrderTestData(); var babyDiaperBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, testValueReturnedFromDb); var testServiceHelper = MockHelperTestServiceHelper.GetTestServiceHelperForUpdating(); var target = new InkoRetentionServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperBll, TestServiceHelper = testServiceHelper }; var actual = target.UpdateRetentionTest(viewModel); Assert.Equal(testValueReturnedFromDb, actual); Assert.Equal(30.21, actual.IncontinencePadTestValue.RetentionWeight); Assert.Equal(430.15, actual.IncontinencePadTestValue.RetentionWetValue); Assert.Equal(212.11, actual.IncontinencePadTestValue.RetentionAfterZentrifuge); Assert.Equal(399.94, actual.IncontinencePadTestValue.RetentionAbsorbtion, 2); Assert.Equal(181.9, actual.IncontinencePadTestValue.RetentionEndValue, 2); Assert.Equal("Hans", actual.LastEditedPerson); Assert.Equal("Fritz", actual.CreatedPerson); Assert.NotEqual(new DateTime(2016, 1, 2), actual.LastEditedDateTime); }
public void UpdateRetentionAverageAndStvNoTestsTest() { var testSheetDataFromDb = GetTestSheetTestDataWithAvgAndStDev(); var productionOrderDataFromDb = GetProductionOrderTestData(); var babyDiaperRetentionBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var target = new BabyDiaperRetentionServiceHelper(new NLogLoggerFactory()) { TestBll = babyDiaperRetentionBll }; var actual = target.UpdateRetentionAverageAndStv(1); var actualAvg = actual.TestValues.FirstOrDefault(tv => (tv.TestValueType == TestValueType.Average) && (tv.BabyDiaperTestValue.TestType == TestTypeBabyDiaper.Retention)); Assert.NotNull(actualAvg); Assert.Equal(0, actualAvg.BabyDiaperTestValue.WeightDiaperDry); Assert.Equal(0, actualAvg.BabyDiaperTestValue.RetentionWetWeight); Assert.Equal(0, actualAvg.BabyDiaperTestValue.RetentionAfterZentrifugeValue); Assert.Equal(0, actualAvg.BabyDiaperTestValue.RetentionAfterZentrifugePercent); Assert.Equal(0, actualAvg.BabyDiaperTestValue.SapGHoewiValue); Assert.Equal(RwType.Ok, actualAvg.BabyDiaperTestValue.RetentionRw); var actualStDev = actual.TestValues.FirstOrDefault( tv => (tv.TestValueType == TestValueType.StandardDeviation) && (tv.BabyDiaperTestValue.TestType == TestTypeBabyDiaper.Retention)); Assert.NotNull(actualStDev); Assert.Equal(0, actualStDev.BabyDiaperTestValue.WeightDiaperDry); Assert.Equal(0, actualStDev.BabyDiaperTestValue.RetentionWetWeight); Assert.Equal(0, actualStDev.BabyDiaperTestValue.RetentionAfterZentrifugeValue); Assert.Equal(0, actualStDev.BabyDiaperTestValue.RetentionAfterZentrifugePercent); Assert.Equal(0, actualStDev.BabyDiaperTestValue.SapGHoewiValue); }
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); }
public void UpdateRetentionTestBaseTest() { var viewModel = new BabyDiaperRetentionEditViewModel { TestPerson = "Hans", TestValueId = 2, TestSheetId = 1, ProductionCodeTime = new TimeSpan(12, 34, 0), ProductionCodeDay = 123, DiaperWeight = 30.1, WeightRetentionWet = 399.8, 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, RetentionWetWeight = 2, TestType = TestTypeBabyDiaper.Retention } }; var testSheetDataFromDb = GetTestSheetTestData(); var productionOrderDataFromDb = GetProductionOrderTestData(); var testBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, testValueReturnedFromDb); var testServiceHelper = MockHelperTestServiceHelper.GetTestServiceHelperForUpdating(); var target = new BabyDiaperRetentionServiceHelper(new NLogLoggerFactory()) { TestBll = testBll, TestServiceHelper = testServiceHelper }; var actual = target.UpdateRetentionTest(viewModel); Assert.Equal(testValueReturnedFromDb, actual); Assert.Equal(30.1, actual.BabyDiaperTestValue.WeightDiaperDry); Assert.Equal(399.8, actual.BabyDiaperTestValue.RetentionWetWeight); Assert.Equal("Hans", actual.LastEditedPerson); Assert.Equal("Fritz", actual.CreatedPerson); Assert.NotEqual(new DateTime(2016, 1, 2), actual.LastEditedDateTime); }
public void UpdateAquisitionAverageAndStvOneTestAvgTest() { var onlyTestValue = new TestValue { TestValueType = TestValueType.Single, ArticleTestType = ArticleType.BabyDiaper, IncontinencePadTestValue = new IncontinencePadTestValue { TestType = TestTypeIncontinencePad.AcquisitionTimeAndRewet, AcquisitionWeight = 21.15, AcquisitionTimeFirst = 17.12, AcquisitionTimeSecond = 54.06, AcquisitionTimeThird = 67.85, RewetAfterAcquisitionTimeDryWeight = 21.73, RewetAfterAcquisitionTimeWetWeight = 21.79, RewetAfterAcquisitionTimeWeightDifference = 0.06, AcquisitionTimeFirstRw = RwType.Ok, AcquisitionTimeSecondRw = RwType.Ok, AcquisitionTimeThirdRw = RwType.Ok, RewetAfterAcquisitionTimeRw = RwType.Ok } }; var testSheetDataFromDb = GetTestSheetTestDataWithAvgAndStDev(); testSheetDataFromDb.TestValues.Add(onlyTestValue); var productionOrderDataFromDb = GetProductionOrderTestData(); var testBll = MockHelperBll.GetTestBllForSavingAndUpdating(testSheetDataFromDb, productionOrderDataFromDb, null); var target = new InkoAquisitionServiceHelper(new NLogLoggerFactory()) { TestBll = testBll }; var actual = target.UpdateAquisitionAverageAndStv(1); var actualAquisitionAvg = actual.TestValues.FirstOrDefault( tv => (tv.TestValueType == TestValueType.Average) && (tv.IncontinencePadTestValue.TestType == TestTypeIncontinencePad.AcquisitionTimeAndRewet)); Assert.NotNull(actualAquisitionAvg); Assert.Equal(21.15, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionWeight); Assert.Equal(17.12, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionTimeFirst); Assert.Equal(54.06, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionTimeSecond); Assert.Equal(67.85, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionTimeThird); Assert.Equal(21.73, actualAquisitionAvg.IncontinencePadTestValue.RewetAfterAcquisitionTimeDryWeight); Assert.Equal(21.79, actualAquisitionAvg.IncontinencePadTestValue.RewetAfterAcquisitionTimeWetWeight); Assert.Equal(0.06, actualAquisitionAvg.IncontinencePadTestValue.RewetAfterAcquisitionTimeWeightDifference); Assert.Equal(RwType.Ok, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionTimeFirstRw); Assert.Equal(RwType.Ok, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionTimeSecondRw); Assert.Equal(RwType.Ok, actualAquisitionAvg.IncontinencePadTestValue.AcquisitionTimeThirdRw); Assert.Equal(RwType.Ok, actualAquisitionAvg.IncontinencePadTestValue.RewetAfterAcquisitionTimeRw); var actualAquisitionStDev = actual.TestValues.FirstOrDefault( tv => (tv.TestValueType == TestValueType.StandardDeviation) && (tv.IncontinencePadTestValue.TestType == TestTypeIncontinencePad.AcquisitionTimeAndRewet)); Assert.NotNull(actualAquisitionStDev); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.AcquisitionWeight); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.AcquisitionTimeFirst); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.AcquisitionTimeSecond); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.AcquisitionTimeThird); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.RewetAfterAcquisitionTimeDryWeight); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.RewetAfterAcquisitionTimeWetWeight); Assert.Equal(0, actualAquisitionStDev.IncontinencePadTestValue.RewetAfterAcquisitionTimeWeightDifference); }