Esempio n. 1
0
        /// <summary>
        /// Loads the attribute label values
        /// </summary>
        /// <param name="commodity"></param>
        private void LoadAttributeLabels(PartServiceCommodity commodity)
        {
            PartAttributesHeader header = commodity.AttributesHeader;

            if (header != null)
            {
                // Show the attributes layout
                attributesLayout.Visibility = LayoutVisibility.Always;

                // set the labels text to the attribute display value
                attr1Layout.Text  = header.Attr1;
                attr2Layout.Text  = header.Attr2;
                attr3Layout.Text  = header.Attr3;
                attr4Layout.Text  = header.Attr4;
                attr5Layout.Text  = header.Attr5;
                attr6Layout.Text  = header.Attr6;
                attr7Layout.Text  = header.Attr7;
                attr8Layout.Text  = header.Attr8;
                attr9Layout.Text  = header.Attr9;
                attr10Layout.Text = header.Attr10;
            }
            else
            {
                // Hide the attributes layout
                attributesLayout.Visibility = LayoutVisibility.Never;
            }
        }
Esempio n. 2
0
        public void part_attributes_return_value_by_label()
        {
            PartAttributesHeader header =
                Xpo.CreateXPObject <PartAttributesHeader>();

            PartAttributeValues values =
                Xpo.CreateXPObject <PartAttributeValues>();

            header.Attr1  = "Firmware";
            values.Header = header;
            values.Attr1  = "E64X";

            Assert.AreEqual(values.GetValueForAttribute("Firmware"), "E64X");
        }
Esempio n. 3
0
        public void can_get_the_value_of_a_property_by_name()
        {
            PartAttributesHeader header =
                Xpo.CreateXPObject <PartAttributesHeader>();

            header.Attr1 = "Firmware";
            header.Attr2 = "MSR";

            Assert.AreEqual(Reflection.GetPropertyValue(header, "Attr1"),
                            "Firmware");

            Assert.AreEqual(Reflection.GetPropertyValue(header, "Attr2"),
                            "MSR");
        }
Esempio n. 4
0
        public void msr_validator_returns_false_when_msr_doesnt_match()
        {
            PartAttributesHeader header =
                Xpo.CreateXPObject <PartAttributesHeader>();

            PartAttributeValues values =
                Xpo.CreateXPObject <PartAttributeValues>();

            header.Attr1  = "ASR";
            values.Header = header;
            values.Attr1  = "A00,A01,A02";

            IValidator validator =
                StepResultValidatorFactory.CreateValidator(StepResultValidationType.MinimumShippableRevision, values, "wr0ng");

            Assert.IsFalse(validator.Validated());
        }
Esempio n. 5
0
        public void firmware_validator_returns_false_when_the_firmware_doesnt_match()
        {
            PartAttributesHeader header =
                Xpo.CreateXPObject <PartAttributesHeader>();

            PartAttributeValues values =
                Xpo.CreateXPObject <PartAttributeValues>();

            header.Attr1  = "Firmware";
            values.Header = header;
            values.Attr1  = "E36X";

            IValidator validator =
                StepResultValidatorFactory.CreateValidator(StepResultValidationType.Firmware, values, "wr0ng");

            Assert.IsFalse(validator.Validated());
        }
Esempio n. 6
0
        /// <summary>
        /// Loads the attributes headers into the display controls
        /// </summary>
        /// <param name="header"></param>
        private void LayoutHeader(PartAttributesHeader header)
        {
            if (header == null)
            {
                return;
            }

            layout1.Text  = header.Attr1;
            layout2.Text  = header.Attr2;
            layout3.Text  = header.Attr3;
            layout4.Text  = header.Attr4;
            layout5.Text  = header.Attr5;
            layout6.Text  = header.Attr6;
            layout7.Text  = header.Attr7;
            layout8.Text  = header.Attr8;
            layout9.Text  = header.Attr9;
            layout10.Text = header.Attr10;
        }
Esempio n. 7
0
        public void process_validator_fails_when_there_are_invalid_steps()
        {
            PartAttributesHeader header =
                Xpo.CreateXPObject <PartAttributesHeader>();

            PartAttributeValues values =
                Xpo.CreateXPObject <PartAttributeValues>();

            header.Attr1 = "Firmware";
            header.Attr2 = "ASR";

            values.Header = header;
            values.Attr1  = "E36X";
            values.Attr2  = "A03";

            // Create step1 with Firmware validation
            RouteStationStep step1 = Xpo.CreateXPObject <RouteStationStep>();

            step1.DisplayPrompt  = "Firmware";
            step1.ValidationType = StepResultValidationType.Firmware;

            // Create step2 with MSR validation
            RouteStationStep step2 = Xpo.CreateXPObject <RouteStationStep>();

            step2.DisplayPrompt  = "Current Revision";
            step2.ValidationType = StepResultValidationType.MinimumShippableRevision;

            // Create step3 with OpenText validation
            RouteStationStep step3 = Xpo.CreateXPObject <RouteStationStep>();

            step3.DisplayPrompt  = "Step3";
            step3.ValidationType = StepResultValidationType.OpenText;

            // Create a test part with dummy attributes
            Part part = Xpo.CreateXPObject <Part>();

            // Set the parts attributes to the fake attributes we created.
            part.Attributes = values;

            // Create Firmware step result
            RouteStationResult result1 =
                Xpo.CreateXPObject <RouteStationResult>();

            result1.Step   = step1;
            result1.Result = "E36X";

            // Create the MSR step result
            RouteStationResult result2 = Xpo.CreateXPObject <RouteStationResult>();

            result2.Step   = step2;
            result2.Result = "A04";

            // Create the OpenText step result
            RouteStationResult result3 = Xpo.CreateXPObject <RouteStationResult>();

            result3.Step   = step3;
            result3.Result = "i can type whatever i want to";

            // Create a station process SCENARIO
            RouteStationProcess process =
                Xpo.CreateXPObject <RouteStationProcess>();

            // Create a fake inventory item
            InventoryItem item = Xpo.CreateXPObject <InventoryItem>();

            // Set the inventory part to the attribute part we've created.
            item.Part = part;

            // Set the process inventory item to the fake inventory item we've created.
            process.Item = item;

            // Add the results to the process
            process.Results.Add(result1);
            process.Results.Add(result2);
            process.Results.Add(result3);

            // Generate a fake process outcome
            StationOutcome outcome = Xpo.CreateXPObject <StationOutcome>();

            outcome.Label = "PASS";

            // Assign the outcome to our fake process
            process.StationOutcome = outcome;

            // Validate the process
            RouteStationProcessValidator validator =
                new RouteStationProcessValidator(process);

            Assert.IsFalse(validator.Validated());
        }