public void GetTestSheetForActualAndLastThreeShiftsFoundTest2() { var now = DateTime.Now; var testsheet = new TestSheet { FaNr = "666", ShiftType = ShiftType.Late, DayInYear = now.DayOfYear, CreatedDateTime = now }; var testsheet2 = new TestSheet { FaNr = "666", ShiftType = ShiftType.Late, DayInYear = now.DayOfYear, CreatedDateTime = now.AddDays(-7) }; var shift = new ShiftSchedule { Name = "The One", ShiftType = ShiftType.Late, EndTime = new TimeSpan(now.Hour + 2, now.Minute + 10, now.Second), StartTime = new TimeSpan(now.Hour - 2, now.Minute - 10, now.Second), StartDay = now.DayOfWeek, EndDay = now.AddDays(1) .DayOfWeek }; var shiftSheduleListQuery = new List <ShiftSchedule> { shift, shift }; var testSheetListQuery = new List <TestSheet> { testsheet, testsheet2 }; var testSheetRepository = MockHelperBll.TestSheetRepository(testSheetListQuery.AsQueryable()); var shifthelper = MockHelperBll.GetShiftHelper(ShiftType.Late, shift, shiftSheduleListQuery); var target = new LaborDashboardBll(new NLogLoggerFactory()) { ShiftHelper = shifthelper, TestSheets = testSheetRepository }; var actual = target.GetTestSheetForActualAndLastThreeShifts(); actual.Count.Should() .Be(1); }
public void GetTestSheetForFaNrTestNormal() { var now = DateTime.Now; var testsheet = new TestSheet { FaNr = "666", ShiftType = ShiftType.Late, DayInYear = now.DayOfYear, CreatedDateTime = now }; var shift = new ShiftSchedule { Name = "The One", ShiftType = ShiftType.Late, EndTime = new TimeSpan(now.Hour + 2, now.Minute, now.Second), StartTime = new TimeSpan(now.Hour - 2, now.Minute, now.Second), StartDay = now.DayOfWeek, EndDay = now.AddDays(1) .DayOfWeek }; var shiftSheduleListQuery = new List <ShiftSchedule> { shift }; var shiftSheduleRepository = MockHelperBll.GetAllShiftSchedules(shiftSheduleListQuery.AsQueryable()); var testSheetList = new List <TestSheet> { testsheet }; var testSheetRepository = MockHelperBll.TestSheetRepository(testSheetList.AsQueryable()); var shifthelper = MockHelperBll.GetShiftHelper(ShiftType.Late); var target = new LaborCreatorBll(new NLogLoggerFactory()) { ProductionOrderRepository = null, ShiftHelper = shifthelper, TestSheetRepository = testSheetRepository }; var actual = target.GetTestSheetForFaNr("666") .Should() .Be(testsheet); }
public void RunningTestSheetsTest2() { var now = DateTime.Now; var testsheet1 = new TestSheet { FaNr = "666", ShiftType = ShiftType.Late, DayInYear = now.DayOfYear }; var testsheet2 = new TestSheet { FaNr = "7", ShiftType = ShiftType.Late, DayInYear = now.DayOfYear }; var testsheet3 = new TestSheet { FaNr = "5", ShiftType = ShiftType.Late, DayInYear = now.DayOfYear + 1 }; var testsheet4 = new TestSheet { FaNr = "127", ShiftType = ShiftType.Morning, DayInYear = now.DayOfYear }; var testsheet5 = new TestSheet { FaNr = "778", ShiftType = ShiftType.Late, DayInYear = now.DayOfYear - 1 }; var testsheet6 = new TestSheet { FaNr = "111", ShiftType = ShiftType.Night, DayInYear = now.DayOfYear - 1 }; var shift = new ShiftSchedule { Name = "The One", ShiftType = ShiftType.Late, EndTime = new TimeSpan(now.Hour + 2, now.Minute, now.Second), StartTime = new TimeSpan(now.Hour - 2, now.Minute, now.Second), StartDay = now.DayOfWeek, EndDay = now.AddDays(1) .DayOfWeek }; var testsheets = new List <TestSheet> { testsheet1, testsheet2 }; var shiftSheduleListQuery = new List <ShiftSchedule> { shift }; var shiftSheduleRepository = MockHelperBll.GetAllShiftSchedules(shiftSheduleListQuery.AsQueryable()); var testSheetList = new List <TestSheet> { testsheet1, testsheet2, testsheet3, testsheet4, testsheet5, testsheet6 }; var testSheetRepository = MockHelperBll.TestSheetRepository(testSheetList.AsQueryable()); var shifthelper = MockHelperBll.GetShiftHelper(ShiftType.Late); var target = new LaborCreatorBll(new NLogLoggerFactory()) { ProductionOrderRepository = null, ShiftHelper = shifthelper, TestSheetRepository = testSheetRepository }; var actual = target.RunningTestSheets(); actual.Count.Should() .Be(2); actual.Should() .BeEquivalentTo(testsheets); }
public void InitTestSheetForFaNrTestPassing() { var now = DateTime.Now; var testsheet = new TestSheet { FaNr = "666", ShiftType = ShiftType.Late, DayInYear = now.DayOfYear }; var shift = new ShiftSchedule { Name = "The One", ShiftType = ShiftType.Late, EndTime = new TimeSpan(now.Hour + 2, now.Minute, now.Second), StartTime = new TimeSpan(now.Hour - 2, now.Minute, now.Second), StartDay = now.DayOfWeek, EndDay = now.AddDays(1) .DayOfWeek }; var productionorder = new ProductionOrder { FaNr = "666", Article = new Article(), Machine = new Machine { MachineNr = "M12" }, Component = new ProductionOrderComponent(), EndDateTime = now, StartDateTime = now, FaId = 1, ArticleId = 1, MachineId = 1 }; var productionOrderListQuery = new List <ProductionOrder> { productionorder }; var shiftSheduleListQuery = new List <ShiftSchedule> { shift }; var testSheetList = new List <TestSheet> { testsheet }; var shiftSheduleRepository = MockHelperBll.GetAllShiftSchedules(shiftSheduleListQuery.AsQueryable()); var productionOrderRepository = MockHelperBll.GetAllProductionOrders(productionOrderListQuery.AsQueryable()); var testSheetRepository = MockHelperBll.TestSheetRepository(testSheetList.AsQueryable()); var shifthelper = MockHelperBll.GetShiftHelper(ShiftType.Late); var target = new LaborCreatorBll(new NLogLoggerFactory()) { ProductionOrderRepository = productionOrderRepository, ShiftHelper = shifthelper, TestSheetRepository = testSheetRepository }; var actual = target.InitTestSheetForFaNr("666"); actual.Should() .NotBeNull("should be initialized"); actual.FaNr.Should() .Be(productionorder.FaNr); actual.ShiftType.Should() .Be(shift.ShiftType); actual.ArticleType.Should() .Be(productionorder.Article.ArticleType); actual.CreatedDateTime.Hour.Should() .Be(now.Hour); actual.CreatedDateTime.Minute.Should() .BeLessOrEqualTo(now.Minute); actual.DayInYear.Should() .Be(now.DayOfYear); actual.MachineNr.Should() .Be(productionorder.Machine.MachineNr); actual.TestValues.Count.Should() .Be(6); actual.TestValues.Should() .Contain(value => value.TestValueType == TestValueType.Average); actual.TestValues.Should() .Contain(value => value.TestValueType == TestValueType.StandardDeviation); actual.SAPNr.Should() .Be(productionorder.Component.ComponentNr); actual.SizeName.Should() .Be(productionorder.Article.SizeName); actual.ProductName.Should() .Be(productionorder.Article.ProductName); actual.SAPType.Should() .Be(productionorder.Component.ComponentType); }