public void BattlemechCTISCheck() { string sFilePath = AtlasTestFile; BattleMechDesign battleMechDesign = MTFReader.ReadBattleMechDesignFile(sFilePath); StructureLocation structure = GetBattleMechStructureLocation(battleMechDesign, "CT"); Assert.Equal(31, structure.MaxStructurePoints); }
/// <summary> /// Creates a <see cref="HeightStructure"/> based on the <paramref name="structureLocation"/> /// and property values defined by <paramref name="structureParameterRows"/>. /// </summary> /// <param name="structureLocation">The representation of the structure.</param> /// <param name="structureParameterRows">The parameters of the structure.</param> /// <returns>A <see cref="HeightStructure"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="structureParameterRows"/> /// contains an element with <see cref="StructuresParameterRow.ParameterId"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException">Thrown when <paramref name="structureParameterRows"/> /// contains a parameter definition with a duplicate name.</exception> private HeightStructure CreateHeightStructure(StructureLocation structureLocation, IEnumerable <StructuresParameterRow> structureParameterRows) { Dictionary <string, StructuresParameterRow> rowData = structureParameterRows.ToDictionary( row => row.ParameterId, row => row, StringComparer.OrdinalIgnoreCase); string structureName = structureLocation.Name; string structureId = structureLocation.Id; var constructionProperties = new HeightStructure.ConstructionProperties { Name = structureName, Id = structureId, Location = structureLocation.Point }; TrySetConstructionProperty((rows, key) => constructionProperties.StructureNormalOrientation = (RoundedDouble)rows[key].NumericalValue, rowData, StructureFilesKeywords.HeightStructureParameterKeyword1, structureName, structureId); TrySetConstructionProperty((rows, key) => { constructionProperties.LevelCrestStructure.Mean = (RoundedDouble)rows[key].NumericalValue; constructionProperties.LevelCrestStructure.StandardDeviation = GetStandardDeviation(rows[key], structureName); }, rowData, StructureFilesKeywords.HeightStructureParameterKeyword2, structureName, structureId); TrySetConstructionProperty((rows, key) => { constructionProperties.FlowWidthAtBottomProtection.Mean = (RoundedDouble)rows[key].NumericalValue; constructionProperties.FlowWidthAtBottomProtection.StandardDeviation = GetStandardDeviation(rows[key], structureName); }, rowData, StructureFilesKeywords.HeightStructureParameterKeyword3, structureName, structureId); TrySetConstructionProperty((rows, key) => { constructionProperties.CriticalOvertoppingDischarge.Mean = (RoundedDouble)rows[key].NumericalValue; constructionProperties.CriticalOvertoppingDischarge.CoefficientOfVariation = GetCoefficientOfVariation(rows[key], structureName); }, rowData, StructureFilesKeywords.HeightStructureParameterKeyword4, structureName, structureId); TrySetConstructionProperty((rows, key) => { constructionProperties.WidthFlowApertures.Mean = (RoundedDouble)rows[key].NumericalValue; constructionProperties.WidthFlowApertures.StandardDeviation = GetStandardDeviation(rows[key], structureName); }, rowData, StructureFilesKeywords.HeightStructureParameterKeyword5, structureName, structureId); TrySetConstructionProperty((rows, key) => constructionProperties.FailureProbabilityStructureWithErosion = rows[key].NumericalValue, rowData, StructureFilesKeywords.HeightStructureParameterKeyword6, structureName, structureId); TrySetConstructionProperty((rows, key) => { constructionProperties.StorageStructureArea.Mean = (RoundedDouble)rows[key].NumericalValue; constructionProperties.StorageStructureArea.CoefficientOfVariation = GetCoefficientOfVariation(rows[key], structureName); }, rowData, StructureFilesKeywords.HeightStructureParameterKeyword7, structureName, structureId); TrySetConstructionProperty((rows, key) => { constructionProperties.AllowedLevelIncreaseStorage.Mean = (RoundedDouble)rows[key].NumericalValue; constructionProperties.AllowedLevelIncreaseStorage.StandardDeviation = GetStandardDeviation(rows[key], structureName); }, rowData, StructureFilesKeywords.HeightStructureParameterKeyword8, structureName, structureId); return(new HeightStructure(constructionProperties)); }