public void SetData_WithEmptyNameAndColor_ExpectedValuesInTable() { // Setup using (var table = new PipingSoilLayerTable()) { PipingSoilLayer soilLayer = CreatePipingSoilLayer(); soilLayer.MaterialName = string.Empty; soilLayer.Color = Color.Empty; PipingSoilLayer[] layers = { soilLayer }; // Call table.SetData(layers); // Assert PipingSoilLayer pipingSoilLayer = layers[0]; DataGridViewCellCollection rowCells = table.Rows[0].Cells; AssertColumnValueEqual("Onbekend", rowCells[nameColumnIndex].Value); AssertColumnValueEqual(Color.White, rowCells[colorColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.Top, rowCells[topColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.IsAquifer, rowCells[isAquiferColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.Permeability.Mean, rowCells[permeabilityMeanColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.Permeability.CoefficientOfVariation, rowCells[permeabilityCoefficientOfVariationColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.DiameterD70.Mean, rowCells[d70MeanColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.DiameterD70.CoefficientOfVariation, rowCells[d70CoefficientOfVariationColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.BelowPhreaticLevel.Mean, rowCells[belowPhreaticLevelWeightMeanColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.BelowPhreaticLevel.StandardDeviation, rowCells[belowPhreaticLevelWeightDeviationColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.BelowPhreaticLevel.Shift, rowCells[belowPhreaticLevelWeightShiftColumnIndex].Value); } }
public void SetData_WithData_ExpectedValuesInTable() { // Setup using (var table = new PipingSoilLayerTable()) { PipingSoilLayer[] layers = { CreatePipingSoilLayer(), CreatePipingSoilLayer(), CreatePipingSoilLayer() }; // Call table.SetData(layers); // Assert Assert.AreEqual(layers.Length, table.Rows.Count); for (var i = 0; i < table.Rows.Count; i++) { PipingSoilLayer pipingSoilLayer = layers[i]; DataGridViewCellCollection rowCells = table.Rows[i].Cells; AssertColumnValueEqual(pipingSoilLayer.MaterialName, rowCells[nameColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.Color, rowCells[colorColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.Top, rowCells[topColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.IsAquifer, rowCells[isAquiferColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.Permeability.Mean, rowCells[permeabilityMeanColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.Permeability.CoefficientOfVariation, rowCells[permeabilityCoefficientOfVariationColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.DiameterD70.Mean, rowCells[d70MeanColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.DiameterD70.CoefficientOfVariation, rowCells[d70CoefficientOfVariationColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.BelowPhreaticLevel.Mean, rowCells[belowPhreaticLevelWeightMeanColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.BelowPhreaticLevel.StandardDeviation, rowCells[belowPhreaticLevelWeightDeviationColumnIndex].Value); AssertColumnValueEqual(pipingSoilLayer.BelowPhreaticLevel.Shift, rowCells[belowPhreaticLevelWeightShiftColumnIndex].Value); } } }
public void SetData_SetNullDataAfterDataAlreadySet_ClearsData() { // Setup using (var table = new PipingSoilLayerTable()) { var layers = new[] { new PipingSoilLayer(2.5), new PipingSoilLayer(2.3), new PipingSoilLayer(1.1) }; table.SetData(layers); // Call table.SetData(null); // Assert Assert.AreEqual(0, table.Rows.Count); } }
public void SetData_SetNewDataAfterDataAlreadySet_ClearDataAndAddNewData() { // Setup using (var table = new PipingSoilLayerTable()) { table.SetData(new[] { new PipingSoilLayer(1.0) }); var newLayers = new[] { new PipingSoilLayer(2.5), new PipingSoilLayer(2.3), new PipingSoilLayer(1.1) }; // Call table.SetData(newLayers); // Assert Assert.AreEqual(newLayers.Length, table.Rows.Count); } }
public void SetData_NoDataAlreadySet_SetNewData() { // Setup using (var table = new PipingSoilLayerTable()) { var layers = new[] { new PipingSoilLayer(2.5), new PipingSoilLayer(2.3), new PipingSoilLayer(1.1) }; // Call table.SetData(layers); // Assert Assert.AreEqual(layers.Length, table.Rows.Count); } }