public void view_fires_event_which_calls_save_on_persistent_model() { IBomMasterView view = new BomMasterViewStub(); BomMasterModel model = new BomMasterModel(Xpo.UnitOfWork()); BomMasterController controller = new BomMasterController(model, view); PartModel partModel = new PartModel(Xpo.UnitOfWork()); model.PartModel = partModel; view.EventsController.ActionRequestEvents.Fire(this, "save"); }
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); }
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"); }
public void duplication_collection_validator_returns_error_on_duplicate() { DuplicateCollectionValueValidator <Person> validator; ICollection <Person> m_people = new Collection <Person>(); m_people.Add(new Person(Xpo.UnitOfWork(), "Justin")); m_people.Add(new Person(Xpo.UnitOfWork(), "Wil")); m_people.Add(new Person(Xpo.UnitOfWork(), "Justin")); m_people.Add(new Person(Xpo.UnitOfWork(), "Mark")); validator = new DuplicateCollectionValueValidator <Person>(m_people, "FirstName"); validator.Validated(); Assert.IsTrue(validator.HasError()); }
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()); }
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()); }
public void view_fires_event_which_creates_new_bom_master_in_model() { IBomMasterView view = new BomMasterViewStub(); BomMasterModel model = new BomMasterModel(Xpo.UnitOfWork()); BomMasterController controller = new BomMasterController(model, view); PartModel partModel = new PartModel(Xpo.UnitOfWork()); model.PartModel = partModel; Assert.IsTrue(model.BomMaster == null); view.EventsController.ActionRequestEvents.Fire(this, "new_bom_master"); Assert.IsTrue(model.BomMaster != null); }
//[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); }
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!"); }
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()); }
public void teardown() { Xpo.Destroy(); }
public void TearDown() { Xpo.Destroy(); }