Example #1
0
            public void InHouseContamination_defects_are_preserved()
            {
                //Arrange
                var chileProduct = CreateChileProduct();
                var openDefect   = new Defect(DefectTypeEnum.InHouseContamination, "test");
                var closedDefect = new Defect(DefectTypeEnum.InHouseContamination, "test2", true);

                List <LotAttributeDefect> lotAttributeDefects;
                var lot = CreateLot(out lotAttributeDefects, new Defects
                {
                    openDefect,
                    closedDefect
                });

                var tblLot = CreateTblLot(lot, lotAttributeDefects);

                //Act
                List <LotAttributeDefect> attributeDefects;

                CreateChileLotHelper.CreateChileLot(tblLot, new Lot(), chileProduct, out attributeDefects);

                //Assert
                openDefect.AssertExpected(lot.LotDefects.Single(d => d.DefectType == DefectTypeEnum.InHouseContamination && d.Resolution == null));
                closedDefect.AssertExpected(lot.LotDefects.Single(d => d.DefectType == DefectTypeEnum.InHouseContamination && d.Resolution != null));
            }
Example #2
0
            public void Removing_an_attribute_from_old_context_will_preserve_closed_defects_and_remove_attribute_from_Lot()
            {
                var chileProduct = CreateChileProduct(new AttributeRanges
                {
                    { StaticAttributeNames.Asta, 0, 1 },
                    { StaticAttributeNames.Scan, 0, 1 }
                });
                var astaDefect = new Defect(StaticAttributeNames.Asta, 2, 0, 1, true);
                var scanDefect = new Defect(StaticAttributeNames.Scan, 3, 0, 1, true);

                List <LotAttributeDefect> lotAttributeDefects;
                var lot = CreateLot(out lotAttributeDefects,
                                    new Defects
                {
                    astaDefect,
                    scanDefect
                },
                                    new Attributes
                {
                    { StaticAttributeNames.Asta, 2 },
                    { StaticAttributeNames.Scan, 3 }
                });

                var tblLot = CreateTblLot(lot, lotAttributeDefects);

                //Act
                List <LotAttributeDefect> attributeDefects;
                var chileLot = CreateChileLotHelper.CreateChileLot(tblLot, new Lot(), chileProduct, out attributeDefects);

                //Assert
                astaDefect.AssertExpected(attributeDefects.Single(a => a.AttributeShortName == StaticAttributeNames.Asta.ShortName));
                scanDefect.AssertExpected(attributeDefects.Single(a => a.AttributeShortName == StaticAttributeNames.Scan.ShortName));
                Assert.IsEmpty(chileLot.Lot.Attributes);
            }
Example #3
0
                public void Open_defect_is_closed_when_old_context_attribute_is_in_range()
                {
                    //Arrange
                    var chileProduct = CreateChileProduct(new AttributeRanges
                    {
                        { StaticAttributeNames.Asta, 0, 1 }
                    });
                    var defect = new Defect(StaticAttributeNames.Asta, 2, 0, 1);

                    List <LotAttributeDefect> lotAttributeDefects;
                    var lot = CreateLot(out lotAttributeDefects,
                                        new Defects
                    {
                        defect
                    },
                                        new Attributes
                    {
                        { StaticAttributeNames.Asta, 2 }
                    });

                    var newAttribute = new Attribute(StaticAttributeNames.Asta, 0.5);
                    var tblLot       = CreateTblLot(lot, lotAttributeDefects, new Attributes
                    {
                        newAttribute
                    });

                    //Act
                    List <LotAttributeDefect> attributeDefects;
                    var chileLot = CreateChileLotHelper.CreateChileLot(tblLot, new Lot(), chileProduct, out attributeDefects);

                    //Assert
                    defect.Resolution = true;
                    defect.AssertExpected(attributeDefects.Single(a => a.AttributeShortName == StaticAttributeNames.Asta.ShortName));
                    newAttribute.AssertExpected(chileLot.Lot);
                }
Example #4
0
                public void Open_defect_value_is_updated_when_old_context_attribute_is_different_and_out_of_range()
                {
                    //Arrange
                    var chileProduct = CreateChileProduct(new AttributeRanges
                    {
                        { StaticAttributeNames.Asta, 0, 1 }
                    });
                    var defect = new Defect(StaticAttributeNames.Asta, 2, 0, 1);

                    List <LotAttributeDefect> lotAttributeDefects;
                    var lot = CreateLot(out lotAttributeDefects,
                                        new Defects
                    {
                        defect
                    },
                                        new Attributes
                    {
                        { StaticAttributeNames.Asta, 2 }
                    });

                    var tblLot = CreateTblLot(lot, lotAttributeDefects, new Attributes
                    {
                        { StaticAttributeNames.Asta, 3 }
                    });

                    //Act
                    List <LotAttributeDefect> attributeDefects;

                    CreateChileLotHelper.CreateChileLot(tblLot, new Lot(), chileProduct, out attributeDefects);

                    //Assert
                    defect.Value = 3;
                    defect.AssertExpected(attributeDefects.Single(a => a.AttributeShortName == StaticAttributeNames.Asta.ShortName));
                }
Example #5
0
                public void Attribute_value_is_updated_and_existing_resolved_defect_is_loaded()
                {
                    //Arrange
                    var chileProduct = CreateChileProduct(new AttributeRanges
                    {
                        { StaticAttributeNames.Asta, 0, 1 }
                    });
                    var defect = new Defect(StaticAttributeNames.Asta, 2, 0, 1, true);

                    List <LotAttributeDefect> lotAttributeDefects;
                    var lot = CreateLot(out lotAttributeDefects,
                                        new Defects
                    {
                        defect
                    },
                                        new Attributes
                    {
                        { StaticAttributeNames.Asta, 0.5 }
                    });

                    var newAttribute = new Attribute(StaticAttributeNames.Asta, 0.75);
                    var tblLot       = CreateTblLot(lot, lotAttributeDefects, new Attributes
                    {
                        newAttribute
                    });

                    //Act
                    List <LotAttributeDefect> attributeDefects;
                    var chileLot = CreateChileLotHelper.CreateChileLot(tblLot, new Lot(), chileProduct, out attributeDefects);

                    //Assert
                    defect.AssertExpected(attributeDefects.Single(a => a.AttributeShortName == StaticAttributeNames.Asta.ShortName));
                    newAttribute.AssertExpected(chileLot.Lot);
                }
Example #6
0
                public void New_LotAttributeDefects_are_created_if_old_context_values_are_out_of_range()
                {
                    //Arrange
                    var expectedDefect = new Defect(StaticAttributeNames.Asta, 3, 0, 1);
                    var chileProduct   = CreateChileProduct(new AttributeRanges
                    {
                        { StaticAttributeNames.Asta, 0, 1 }
                    });

                    List <LotAttributeDefect> lotAttributeDefects;
                    var lot = CreateLot(out lotAttributeDefects);

                    var newAttribute = new Attribute(StaticAttributeNames.Asta, 3);
                    var tblLot       = CreateTblLot(lot, lotAttributeDefects, new Attributes {
                        newAttribute
                    });

                    //Act
                    List <LotAttributeDefect> attributeDefects;
                    var chileLot = CreateChileLotHelper.CreateChileLot(tblLot, new Lot(), chileProduct, out attributeDefects);

                    //Assert
                    expectedDefect.AssertExpected(attributeDefects.Single(a => a.AttributeShortName == StaticAttributeNames.Asta.ShortName));
                    newAttribute.AssertExpected(chileLot.Lot);
                }
Example #7
0
                public void Defect_is_as_expected_when_old_context_attribute_value_is_equal_to_deserialized_attribute_value()
                {
                    //Arrange
                    var chileProduct = CreateChileProduct(new AttributeRanges
                    {
                        { StaticAttributeNames.Asta, 0, 1 }
                    });
                    var defect = new Defect(StaticAttributeNames.Asta, 2, 0, 1);

                    List <LotAttributeDefect> lotAttributeDefects;
                    var lot = CreateLot(out lotAttributeDefects,
                                        new Defects
                    {
                        defect
                    },
                                        new Attributes
                    {
                        { StaticAttributeNames.Asta, 2 }
                    });

                    var tblLot = CreateTblLot(lot, lotAttributeDefects, new Attributes
                    {
                        { StaticAttributeNames.Asta, 2 }
                    });

                    //Act
                    List <LotAttributeDefect> attributeDefects;

                    CreateChileLotHelper.CreateChileLot(tblLot, new Lot(), chileProduct, out attributeDefects);

                    //Assert
                    defect.AssertExpected(attributeDefects.Single(a => a.AttributeShortName == StaticAttributeNames.Asta.ShortName));
                }
 public LotEntityObjectMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback) : base(oldContext, loggingCallback)
 {
     if (newContext == null)
     {
         throw new ArgumentNullException("newContext");
     }
     _newContextHelper     = new NewContextHelper(newContext);
     _createChileLotHelper = new CreateChileLotHelper(this, oldContext.CreateObjectSet <tblLotStatu>());
 }
Example #9
0
                public void Closed_defect_is_loaded_and_new_open_defect_is_created_if_value_is_out_of_range()
                {
                    //Arrange
                    var chileProduct = CreateChileProduct(new AttributeRanges
                    {
                        { StaticAttributeNames.Asta, 0, 1 }
                    });
                    var defect = new Defect(StaticAttributeNames.Asta, 2, 0, 1, true);

                    List <LotAttributeDefect> lotAttributeDefects;
                    var lot = CreateLot(out lotAttributeDefects,
                                        new Defects
                    {
                        defect
                    },
                                        new Attributes
                    {
                        { StaticAttributeNames.Asta, 0.5 }
                    });

                    var newAttribute = new Attribute(StaticAttributeNames.Asta, 3);
                    var tblLot       = CreateTblLot(lot, lotAttributeDefects, new Attributes
                    {
                        newAttribute
                    });

                    //Act
                    List <LotAttributeDefect> attributeDefects;
                    var chileLot = CreateChileLotHelper.CreateChileLot(tblLot, new Lot(), chileProduct, out attributeDefects);

                    //Assert
                    defect.AssertExpected(attributeDefects.Single(a => a.AttributeShortName == StaticAttributeNames.Asta.ShortName && a.LotDefect.Resolution != null));

                    defect.Resolution = false;
                    defect.Value      = 3;
                    defect.AssertExpected(attributeDefects.Single(a => a.AttributeShortName == StaticAttributeNames.Asta.ShortName && a.LotDefect.Resolution == null));
                    newAttribute.AssertExpected(chileLot.Lot);
                }