public void MappingRulesTestFixture_TransformOneSinglePart() { STEP3D_Part part = new STEP3D_Part { stepId = 1, type = "PD", name = "Spider1", representation_type = "Shape_Representation" }; STEP3D_PartRelation relation = new STEP3D_PartRelation { id = "Spider1:1", related_id = 1, relating_id = 2, stepId = 211, type = "NUAO" }; Step3DRowViewModel stepModel = new Step3DRowViewModel(part, relation, "step_assembly"); stepModel.UpdateMappingStatus(); List <Step3DRowViewModel> inputValues = new List <Step3DRowViewModel>(); inputValues.Add(stepModel); Step3DPartToElementDefinitionRule translator = new Step3DPartToElementDefinitionRule(); List <ElementBase> outputList; (_, outputList) = translator.Transform(inputValues); var elements = outputList.OfType <ElementDefinition>().ToList(); var parameter = elements.Last().Parameter.First(); var values = parameter.ValueSet.Last(); // We check if the parameter type is correct Assert.IsTrue(parameter.ParameterType is CompoundParameterType); // We expect the user friendlyname to denote a step_geo parameter Assert.IsTrue(parameter.UserFriendlyName.Equals(".step_geo")); CompoundParameterType compound = (CompoundParameterType)parameter.ParameterType; var numberofvalues = compound.NumberOfValues; // We check the number of values Assert.IsTrue(numberofvalues == 6); // we check the values Assert.IsTrue(values.Computed[NAME].Equals("Spider1")); Assert.IsTrue(values.Computed[ID].Equals("1")); Assert.IsTrue(values.Computed[REPRESENTATION_TYPE].Equals("Shape_Representation")); Assert.IsTrue(values.Computed[ASSEMBLY_LABEL].Equals("Spider1:1")); Assert.IsTrue(values.Computed[ASSEMBLY_ID].Equals("211")); Assert.IsTrue(values.Computed[SOURCE].Equals("")); }
/// <summary> /// Constructor /// </summary> /// <param name="part">The <see cref="Step3DRowViewModel"/></param> /// <param name="fields">The <see cref="ValueArray{string}"/> of the <see cref="IValueSet"/> of interest to be updated</param> /// <param name="componentIndex">The index corresponding to the source field</param> public MappedParameterValue(Step3DRowViewModel part, ValueArray <string> fields, int componentIndex) { this.Part = part; this.Fields = fields; this.componentIndex = componentIndex; }
/// <summary> /// Constructor /// </summary> /// <param name="part">The <see cref="Step3DRowViewModel"/></param> /// <param name="values">The <see cref="ValueArray{string}"/> of the target <see cref="IValueSet"/></param> /// <param name="componentIndex">The index corresponding to the source field</param> public Step3DTargetSourceParameter(Step3DRowViewModel part, ValueArray <string> values, int componentIndex) { this.part = part; this.values = values; this.componentIndex = componentIndex; }