public void Constructor_ConstructionPropertiesWithData_ExpectedValues() { // Setup var random = new Random(21); double factorOfStability = random.NextDouble(); double xEntryMin = random.NextDouble(); double xEntryMax = random.NextDouble(); var constructionProperties = new UpliftVanCalculatorResult.ConstructionProperties { FactorOfStability = factorOfStability, ForbiddenZonesXEntryMin = xEntryMin, ForbiddenZonesXEntryMax = xEntryMax }; UpliftVanSlidingCurveResult slidingCurveResult = UpliftVanSlidingCurveResultTestFactory.Create(); // Call var result = new UpliftVanCalculatorResult(slidingCurveResult, CreateGridResult(), new MacroStabilityInwardsKernelMessage[0], constructionProperties); // Assert Assert.AreEqual(factorOfStability, result.FactorOfStability); Assert.AreEqual(xEntryMin, result.ForbiddenZonesXEntryMin); Assert.AreEqual(xEntryMax, result.ForbiddenZonesXEntryMax); }
public void Constructor_ConstructionPropertiesNull_ThrowsArgumentNullException() { // Setup UpliftVanSlidingCurveResult slidingCurveResult = UpliftVanSlidingCurveResultTestFactory.Create(); // Call void Call() => new UpliftVanCalculatorResult(slidingCurveResult, CreateGridResult(), new MacroStabilityInwardsKernelMessage[0], null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("properties", exception.ParamName); }
public void Convert_WithResult_ReturnConvertedSlidingCurve() { // Setup UpliftVanSlidingCurveResult result = UpliftVanSlidingCurveResultTestFactory.Create(); // Call MacroStabilityInwardsSlidingCurve output = MacroStabilityInwardsSlidingCurveConverter.Convert(result); // Assert Assert.AreEqual(result.IteratedHorizontalForce, output.IteratedHorizontalForce); Assert.AreEqual(result.NonIteratedHorizontalForce, output.NonIteratedHorizontalForce); AssertCircle(result.LeftCircle, output.LeftCircle); AssertCircle(result.RightCircle, output.RightCircle); AssertSlices(result.Slices, output.Slices); }
public void Constructor_EmptyConstructionProperties_ExpectedValues() { // Setup UpliftVanSlidingCurveResult slidingCurveResult = UpliftVanSlidingCurveResultTestFactory.Create(); // Call var result = new UpliftVanCalculatorResult(slidingCurveResult, CreateGridResult(), new MacroStabilityInwardsKernelMessage[0], new UpliftVanCalculatorResult.ConstructionProperties()); // Assert Assert.IsNaN(result.FactorOfStability); Assert.IsNaN(result.ForbiddenZonesXEntryMin); Assert.IsNaN(result.ForbiddenZonesXEntryMax); }
public void Constructor_WithParameters_ExpectedValues() { // Setup UpliftVanSlidingCurveResult slidingCurveResult = UpliftVanSlidingCurveResultTestFactory.Create(); UpliftVanCalculationGridResult calculationGridResult = CreateGridResult(); IEnumerable <MacroStabilityInwardsKernelMessage> calculationMessages = new List <MacroStabilityInwardsKernelMessage>(); // Call var result = new UpliftVanCalculatorResult(slidingCurveResult, calculationGridResult, calculationMessages, new UpliftVanCalculatorResult.ConstructionProperties()); // Assert Assert.AreSame(slidingCurveResult, result.SlidingCurveResult); Assert.AreSame(calculationGridResult, result.CalculationGridResult); Assert.AreSame(calculationMessages, result.CalculationMessages); }
private static UpliftVanCalculatorResult CreateUpliftVanCalculatorResult(IEnumerable <MacroStabilityInwardsKernelMessage> calculationMessages) { return(new UpliftVanCalculatorResult( UpliftVanSlidingCurveResultTestFactory.Create(), new UpliftVanCalculationGridResult( UpliftVanGridTestFactory.Create(), UpliftVanGridTestFactory.Create(), new[] { 3, 2, 1.5 }), calculationMessages, new UpliftVanCalculatorResult.ConstructionProperties { FactorOfStability = 0.1, ForbiddenZonesXEntryMin = 0.3, ForbiddenZonesXEntryMax = 0.4 })); }