Пример #1
0
            public void Updates_existing_tblLot_record_and_KillSwitch_will_not_have_been_engaged_if_service_method_and_synchronization_were_successful()
            {
                //Arrange


                var attributeLotStats   = StaticAttributeNames.GetAttributesWithAssociatedLotStats().Select(a => a.AttributeNameKey_ShortName).ToArray();
                var lotAttributeDefects = RVCUnitOfWork.LotAttributeDefectRepository.All();
                var chileLot            = RVCUnitOfWork.ChileLotRepository.Filter(c =>
                                                                                  c.Lot.Hold == null &&
                                                                                  c.Lot.QualityStatus == LotQualityStatus.Released &&
                                                                                  c.Lot.ProductSpecOutOfRange &&
                                                                                  lotAttributeDefects.Where(d => d.LotDateCreated == c.LotDateCreated && d.LotDateSequence == c.LotDateSequence && d.LotTypeId == c.LotTypeId && d.LotDefect.Resolution == null)
                                                                                  .All(d => attributeLotStats.All(a => a != d.AttributeShortName))
                                                                                  ).FirstOrDefault();

                if (chileLot == null)
                {
                    throw new Exception("Could not find ChileLot valid for testing.");
                }

                //Act
                var result = Service.CreateLotDefect(new CreateLotDefectParameters
                {
                    UserToken   = TestUser.UserName,
                    LotKey      = new LotKey(chileLot),
                    DefectType  = DefectTypeEnum.InHouseContamination,
                    Description = "dark specs"
                });
                var lotString = GetKeyFromConsoleString(ConsoleOutput.UpdatedLot);

                //Assert
                result.AssertSuccess();
                MockKillSwitch.Verify(k => k.Engage(), Times.Never());

                var newLot = int.Parse(lotString);
                var tblLot = new RioAccessSQLEntities().tblLots.FirstOrDefault(a => a.Lot == newLot);

                Assert.AreEqual((int?)LotStat.Dark_Specs, tblLot.LotStat);
            }
Пример #2
0
            public void Will_create_new_tblLotHistory_record_if_new_defect_results_in_a_LotStat_change()
            {
                //Arrange
                var attributeLotStats   = StaticAttributeNames.GetAttributesWithAssociatedLotStats().Select(a => a.AttributeNameKey_ShortName).ToArray();
                var lotAttributeDefects = RVCUnitOfWork.LotAttributeDefectRepository.All();
                var chileLot            = RVCUnitOfWork.ChileLotRepository.Filter(c =>
                                                                                  c.Lot.Hold == null &&
                                                                                  c.Lot.QualityStatus == LotQualityStatus.Released &&
                                                                                  c.Lot.ProductSpecOutOfRange &&
                                                                                  lotAttributeDefects.Where(d => d.LotDateCreated == c.LotDateCreated && d.LotDateSequence == c.LotDateSequence && d.LotTypeId == c.LotTypeId && d.LotDefect.Resolution == null)
                                                                                  .All(d => attributeLotStats.All(a => a != d.AttributeShortName))
                                                                                  ).FirstOrDefault();

                if (chileLot == null)
                {
                    Assert.Inconclusive("Could not find ChileLot valid for testing.");
                }
                var lotNumber = LotNumberBuilder.BuildLotNumber(chileLot);
                var expectedLotAttributeHistories = new RioAccessSQLEntities().tblLotAttributeHistories.Count(h => h.Lot == lotNumber) + 1;

                //Act
                var result = Service.CreateLotDefect(new CreateLotDefectParameters
                {
                    UserToken   = TestUser.UserName,
                    LotKey      = new LotKey(chileLot),
                    DefectType  = DefectTypeEnum.InHouseContamination,
                    Description = "dark specs"
                });
                var lotString = GetKeyFromConsoleString(ConsoleOutput.UpdatedLot);

                //Assert
                result.AssertSuccess();
                MockKillSwitch.Verify(k => k.Engage(), Times.Never());
                Assert.AreEqual(lotNumber, int.Parse(lotString));
                Assert.AreEqual(expectedLotAttributeHistories, new RioAccessSQLEntities().tblLotAttributeHistories.Count(h => h.Lot == lotNumber));
            }