public void Returns_false_and_LotStat_will_not_have_been_set_if_no_LotAttributes_or_defects_exist()
            {
                var oldLot = new tblLot();

                Assert.IsFalse(LotSyncHelper.SetProductSpecDefectStat(oldLot, null, null, null));
                Assert.IsNull(oldLot.LotStat);
            }
            public void Returns_true_and_LotStat_will_have_been_set_as_expected_for_ProductSpec_defect()
            {
                var oldLot = new tblLot();

                Assert.IsTrue(LotSyncHelper.SetProductSpecDefectStat(oldLot, null, null, new List <IAttributeDefect>
                {
                    GetLotStatHelperTests.BuildProductSpecDefect(StaticAttributeNames.H2O, 1, 2, 3, false)
                }));
                Assert.AreEqual((int)LotStat.Low_Water, oldLot.LotStat);
            }
            public void Returns_false_and_LotStat_will_not_have_been_set_if_no_defects_of_ProductSpec_type_exist()
            {
                var oldLot = new tblLot();

                Assert.IsFalse(LotSyncHelper.SetProductSpecDefectStat(oldLot, null, null, new List <IAttributeDefect>
                {
                    new LotAttributeDefect
                    {
                        LotDefect = new LotDefect {
                            DefectType = DefectTypeEnum.BacterialContamination
                        },
                    }
                }));
                Assert.IsNull(oldLot.LotStat);
            }
            public void Returns_false_and_LotStat_will_not_have_been_set_if_all_defects_for_an_attribute_are_resolved()
            {
                var oldLot = new tblLot();

                Assert.False(LotSyncHelper.SetProductSpecDefectStat(oldLot, new List <LotAttribute>
                {
                    new LotAttribute
                    {
                        AttributeShortName = StaticAttributeNames.H2O.ShortName,
                        AttributeValue     = 1
                    },
                },
                                                                    new List <CustomerProductAttributeRange>
                {
                    new CustomerProductAttributeRange
                    {
                        RangeMin           = 2,
                        RangeMax           = 3,
                        AttributeShortName = StaticAttributeNames.H2O.ShortName
                    }
                },
                                                                    new List <IAttributeDefect>
                {
                    new LotAttributeDefect
                    {
                        AttributeShortName = StaticAttributeNames.H2O.ShortName,
                        LotDefect          = new LotDefect
                        {
                            DefectType = DefectTypeEnum.ProductSpec,
                            Resolution = new LotDefectResolution()
                        }
                    },
                    new LotAttributeDefect
                    {
                        AttributeShortName = StaticAttributeNames.H2O.ShortName,
                        LotDefect          = new LotDefect
                        {
                            DefectType = DefectTypeEnum.ProductSpec,
                            Resolution = new LotDefectResolution()
                        }
                    },
                }));
                Assert.IsNull(oldLot.LotStat);
            }
            public void Returns_true_and_LotStat_will_have_been_set_if_a_single_unresolved_defect_exists_for_an_attribute()
            {
                var oldLot = new tblLot();

                Assert.IsTrue(LotSyncHelper.SetProductSpecDefectStat(oldLot, new List <LotAttribute>
                {
                    new LotAttribute
                    {
                        AttributeShortName = StaticAttributeNames.H2O.ShortName,
                        AttributeValue     = 1
                    },
                },
                                                                     new List <CustomerProductAttributeRange>
                {
                    new CustomerProductAttributeRange
                    {
                        RangeMin           = 2,
                        RangeMax           = 3,
                        AttributeShortName = StaticAttributeNames.H2O.ShortName
                    }
                },
                                                                     new List <IAttributeDefect>
                {
                    new LotAttributeDefect
                    {
                        AttributeShortName = StaticAttributeNames.H2O.ShortName,
                        LotDefect          = new LotDefect
                        {
                            DefectType = DefectTypeEnum.ProductSpec,
                            Resolution = new LotDefectResolution()
                        }
                    },
                    new LotAttributeDefect
                    {
                        AttributeShortName = StaticAttributeNames.H2O.ShortName,
                        LotDefect          = new LotDefect
                        {
                            DefectType = DefectTypeEnum.ProductSpec
                        }
                    },
                }));
                Assert.AreEqual((int)LotStat.Low_Water, oldLot.LotStat);
            }
            public void Returns_true_and_LotStat_will_have_been_set_if_attribute_is_out_of_range_of_a_customer_spec()
            {
                var oldLot = new tblLot();

                Assert.IsTrue(LotSyncHelper.SetProductSpecDefectStat(oldLot, new List <LotAttribute>
                {
                    new LotAttribute
                    {
                        AttributeValue     = 1,
                        AttributeShortName = StaticAttributeNames.H2O.ShortName
                    }
                },
                                                                     new List <CustomerProductAttributeRange>
                {
                    new CustomerProductAttributeRange
                    {
                        RangeMin           = 2,
                        RangeMax           = 3,
                        AttributeShortName = StaticAttributeNames.H2O.ShortName
                    }
                }, null));
                Assert.AreEqual((int)LotStat.Low_Water, oldLot.LotStat);
            }