Exemple #1
0
        public void when_the_first_failure_is_added_to_the_collection_it_is_set_to_the_fp_error_code()
        {
            RouteStationProcess process = Xpo.CreateXPObject <RouteStationProcess>();
            InventoryItem       item    = Xpo.CreateXPObject <InventoryItem>();

            process.Item = item;

            ServiceCode         serviceCode = Xpo.CreateXPObject <ServiceCode>();
            RouteStationFailure firstFailure;

            firstFailure = process.AddFailure(serviceCode, "test");
            Assert.That(firstFailure.IsFpErrorCode);
        }
Exemple #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");
        }
Exemple #3
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());
        }
Exemple #4
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());
        }
Exemple #5
0
        //[Test]
        public void when_the_fp_error_code_is_deleted_it_should_be_reset_to_the_first_fail_code()
        {
            RouteStationProcess process = Xpo.CreateXPObject <RouteStationProcess>();
            InventoryItem       item    = Xpo.CreateXPObject <InventoryItem>();

            process.Item = item;

            ServiceCode firstCode = Xpo.CreateXPObject <ServiceCode>();

            process.AddFailure(firstCode, "first");

            ServiceCode secondCode = Xpo.CreateXPObject <ServiceCode>();

            process.AddFailure(secondCode, "delete_me");

            //process.ChangeFpErrorCode(1);

            process.AllProcessFailures.Remove(process.Failures[1]);

            Assert.That(process.Failures[0].IsFpErrorCode);
        }
Exemple #6
0
        public void the_fp_error_code_should_be_allowed_to_change_to_a_different_fail_code()
        {
            RouteStationProcess process = Xpo.CreateXPObject <RouteStationProcess>();
            InventoryItem       item    = Xpo.CreateXPObject <InventoryItem>();

            process.Item = item;

            ServiceCode         firstCode = Xpo.CreateXPObject <ServiceCode>();
            RouteStationFailure firstFailure;

            firstFailure = process.AddFailure(firstCode, "first");

            Assert.That(firstFailure.IsFpErrorCode, "The first failure was not set to the fp error code!");

            ServiceCode         secondCode = Xpo.CreateXPObject <ServiceCode>();
            RouteStationFailure shouldBeFpFailure;

            shouldBeFpFailure = process.AddFailure(secondCode, "should_be_fp");

            process.ChangeFpErrorCodeOwner(shouldBeFpFailure);

            Assert.That(shouldBeFpFailure.IsFpErrorCode, "Changing of the fp error code did not succeed!");
            Assert.That(firstFailure.IsFpErrorCode == false, "The previous fp error code owner was not relieved!");
        }
Exemple #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());
        }