コード例 #1
0
        public void SetData_WithData_ExpectedValuesInTable()
        {
            // Setup
            using (var table = new MacroStabilityInwardsSoilLayerDataTable())
            {
                MacroStabilityInwardsSoilLayerData[] layers =
                {
                    CreateMacroStabilityInwardsSoilLayerData(),
                    CreateMacroStabilityInwardsSoilLayerData(),
                    CreateMacroStabilityInwardsSoilLayerData()
                };
                table.SetData(new[]
                {
                    new MacroStabilityInwardsSoilLayerData()
                });

                // Call
                table.SetData(layers);

                // Assert
                Assert.AreEqual(layers.Length, table.Rows.Count);
                for (var i = 0; i < table.Rows.Count; i++)
                {
                    MacroStabilityInwardsSoilLayerData soilLayerData = layers[i];
                    DataGridViewCellCollection         rowCells      = table.Rows[i].Cells;
                    Assert.AreEqual(soilLayerData.MaterialName,
                                    rowCells[nameColumnIndex].Value);
                    Assert.AreEqual(soilLayerData.Color,
                                    rowCells[colorColumnIndex].Value);
                    Assert.AreEqual(soilLayerData.IsAquifer,
                                    rowCells[isAquiferColumnIndex].Value);
                    AssertShiftedDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(soilLayerData),
                                                                rowCells[abovePhreaticLevelColumnIndex].Value);
                    AssertShiftedDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(soilLayerData),
                                                                rowCells[belowPhreaticLevelColumnIndex].Value);
                    Assert.AreEqual(soilLayerData.ShearStrengthModel,
                                    rowCells[shearStrengthModelColumnIndex].Value);
                    AssertDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(soilLayerData),
                                                         rowCells[cohesionColumnIndex].Value);
                    AssertDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(soilLayerData),
                                                         rowCells[frictionAngleColumnIndex].Value);
                    AssertDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(soilLayerData),
                                                         rowCells[shrearStrengthRatioColumnIndex].Value);
                    AssertDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(soilLayerData),
                                                         rowCells[strengthIncreaseExponentColumnIndex].Value);
                    Assert.AreEqual(soilLayerData.UsePop,
                                    rowCells[usePopColumnIndex].Value);
                    AssertDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(soilLayerData),
                                                         rowCells[popColumnIndex].Value);
                }
            }
        }
コード例 #2
0
        public void SetData_SetNullDataAfterDataAlreadySet_ClearsData()
        {
            // Setup
            using (var table = new MacroStabilityInwardsSoilLayerDataTable())
            {
                var layers = new[]
                {
                    new MacroStabilityInwardsSoilLayerData(),
                    new MacroStabilityInwardsSoilLayerData(),
                    new MacroStabilityInwardsSoilLayerData()
                };
                table.SetData(layers);

                // Call
                table.SetData(null);

                // Assert
                Assert.AreEqual(0, table.Rows.Count);
            }
        }
コード例 #3
0
        public void SetData_SetNewDataAfterDataAlreadySet_ClearDataAndAddNewData()
        {
            // Setup
            using (var table = new MacroStabilityInwardsSoilLayerDataTable())
            {
                table.SetData(new[]
                {
                    new MacroStabilityInwardsSoilLayerData()
                });

                var newLayers = new[]
                {
                    new MacroStabilityInwardsSoilLayerData(),
                    new MacroStabilityInwardsSoilLayerData(),
                    new MacroStabilityInwardsSoilLayerData()
                };

                // Call
                table.SetData(newLayers);

                // Assert
                Assert.AreEqual(newLayers.Length, table.Rows.Count);
            }
        }
コード例 #4
0
        public void SetData_NoDataAlreadySet_SetNewData()
        {
            // Setup
            using (var table = new MacroStabilityInwardsSoilLayerDataTable())
            {
                var layers = new[]
                {
                    new MacroStabilityInwardsSoilLayerData(),
                    new MacroStabilityInwardsSoilLayerData(),
                    new MacroStabilityInwardsSoilLayerData()
                };

                // Call
                table.SetData(layers);

                // Assert
                Assert.AreEqual(layers.Length, table.Rows.Count);
            }
        }