private static void AssertConstructionStages( UpliftVanCalculatorInput input, StabilityInput stabilityModel, SoilProfile soilProfile, Waternet dailyWaternet, Waternet extremeWaternet, IDictionary <SoilLayer, LayerWithSoil> layerLookup) { Assert.AreEqual(2, stabilityModel.ConstructionStages.Count); ConstructionStage dailyConstructionStage = stabilityModel.ConstructionStages.ElementAt(0); Assert.AreSame(soilProfile, dailyConstructionStage.SoilProfile); Assert.AreSame(dailyWaternet, dailyConstructionStage.Waternet); CollectionAssert.AreEqual(FixedSoilStressCreator.Create(layerLookup), dailyConstructionStage.FixedSoilStresses, new FixedSoilStressComparer()); CollectionAssert.AreEqual(PreconsolidationStressCreator.Create(input.SoilProfile.PreconsolidationStresses), dailyConstructionStage.PreconsolidationStresses, new PreconsolidationStressComparer()); AssertMultiplicationFactors(dailyConstructionStage.MultiplicationFactorsCPhiForUplift.Single()); AssertIrrelevantValues(dailyConstructionStage); ConstructionStage extremeConstructionStage = stabilityModel.ConstructionStages.ElementAt(1); Assert.AreSame(soilProfile, extremeConstructionStage.SoilProfile); Assert.AreSame(extremeWaternet, extremeConstructionStage.Waternet); CollectionAssert.IsEmpty(extremeConstructionStage.FixedSoilStresses); CollectionAssert.IsEmpty(extremeConstructionStage.PreconsolidationStresses); AssertMultiplicationFactors(extremeConstructionStage.MultiplicationFactorsCPhiForUplift.Single()); AssertIrrelevantValues(extremeConstructionStage); }
public void Create_LayerLookupNull_ThrowsArgumentNullException() { // Call void Call() => FixedSoilStressCreator.Create(null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("layerLookup", exception.ParamName); }
public void Create_WithValidData_ReturnsFixedSoilStresses() { // Setup var lookup = new Dictionary <SoilLayer, LayerWithSoil> { { CreateSoilLayer(new Point2D[0], true, 22), CreateLayerWithSoil(new Point2D[0], "Material 1") }, { CreateSoilLayer(new Point2D[0], false), CreateLayerWithSoil(new Point2D[0], "Material 2") }, { CreateSoilLayer(new Point2D[0], true, 23), CreateLayerWithSoil(new Point2D[0], "Material 3") }, { CreateSoilLayer(new Point2D[0], true, 24), CreateLayerWithSoil(new Point2D[0], "Material 4") } }; // Call IEnumerable <FixedSoilStress> fixedSoilStresses = FixedSoilStressCreator.Create(lookup); // Assert IEnumerable <KeyValuePair <SoilLayer, LayerWithSoil> > lookUpWithPop = lookup.Where(l => l.Key.UsePop); Assert.AreEqual(lookUpWithPop.Count(), fixedSoilStresses.Count()); for (var i = 0; i < fixedSoilStresses.Count(); i++) { KeyValuePair <SoilLayer, LayerWithSoil> keyValuePair = lookUpWithPop.ElementAt(i); FixedSoilStress fixedSoilStress = fixedSoilStresses.ElementAt(i); Assert.AreEqual(keyValuePair.Value.Soil, fixedSoilStress.Soil); Assert.AreEqual(keyValuePair.Key.Pop, fixedSoilStress.POP); } }