public void Clone_Always_ReturnNewInstanceWithCopiedValues() { // Setup var random = new Random(21); var slidingCurve = new MacroStabilityInwardsSlidingCurve(MacroStabilityInwardsSlidingCircleTestFactory.Create(), MacroStabilityInwardsSlidingCircleTestFactory.Create(), new[] { MacroStabilityInwardsSliceTestFactory.CreateSlice() }, random.NextDouble(), random.NextDouble()); var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(MacroStabilityInwardsGridTestFactory.Create(), MacroStabilityInwardsGridTestFactory.Create(), new[] { random.NextRoundedDouble() }); var properties = new MacroStabilityInwardsOutput.ConstructionProperties { FactorOfStability = random.NextDouble(), ForbiddenZonesXEntryMin = random.NextDouble(), ForbiddenZonesXEntryMax = random.NextDouble() }; var original = new MacroStabilityInwardsOutput(slidingCurve, slipPlane, properties); // Call object clone = original.Clone(); // Assert CoreCloneAssert.AreObjectClones(original, clone, MacroStabilityInwardsCloneAssert.AreClones); }
public void Constructor_ExpectedValues() { // Setup var random = new Random(21); MacroStabilityInwardsSlidingCircle rightCircle = MacroStabilityInwardsSlidingCircleTestFactory.Create(); MacroStabilityInwardsSlidingCircle leftCircle = MacroStabilityInwardsSlidingCircleTestFactory.Create(); MacroStabilityInwardsSlice[] slices = { MacroStabilityInwardsSliceTestFactory.CreateSlice() }; double nonIteratedHorizontalForce = random.NextDouble(); double iteratedHorizontalForce = random.NextDouble(); // Call var curve = new MacroStabilityInwardsSlidingCurve(leftCircle, rightCircle, slices, nonIteratedHorizontalForce, iteratedHorizontalForce); // Assert Assert.IsInstanceOf <ICloneable>(curve); Assert.AreSame(leftCircle, curve.LeftCircle); Assert.AreSame(rightCircle, curve.RightCircle); Assert.AreEqual(nonIteratedHorizontalForce, curve.NonIteratedHorizontalForce); Assert.AreEqual(iteratedHorizontalForce, curve.IteratedHorizontalForce); Assert.AreSame(slices, curve.Slices); }
public void Constructor_SlicesNull_ThrowsArgumentNullException() { // Setup MacroStabilityInwardsSlidingCircle circle = MacroStabilityInwardsSlidingCircleTestFactory.Create(); // Call TestDelegate call = () => new MacroStabilityInwardsSlidingCurve(circle, circle, null, 0, 0); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("slices", exception.ParamName); }
public void Constructor_RightCircleNull_ThrowsArgumentNullException() { // Setup MacroStabilityInwardsSlidingCircle leftCircle = MacroStabilityInwardsSlidingCircleTestFactory.Create(); // Call TestDelegate call = () => new MacroStabilityInwardsSlidingCurve(leftCircle, null, Enumerable.Empty <MacroStabilityInwardsSlice>(), 0, 0); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("rightCircle", exception.ParamName); }
public void Constructor_SlipPlaneNull_ThrowsArgumentNullException() { // Setup var slidingCurve = new MacroStabilityInwardsSlidingCurve(MacroStabilityInwardsSlidingCircleTestFactory.Create(), MacroStabilityInwardsSlidingCircleTestFactory.Create(), new MacroStabilityInwardsSlice[0], 0, 0); // Call TestDelegate call = () => new MacroStabilityInwardsOutput(slidingCurve, null, new MacroStabilityInwardsOutput.ConstructionProperties()); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("slipPlane", exception.ParamName); }
public void Clone_Always_ReturnNewInstanceWithCopiedValues() { // Setup var random = new Random(21); MacroStabilityInwardsSlidingCircle rightCircle = MacroStabilityInwardsSlidingCircleTestFactory.Create(); MacroStabilityInwardsSlidingCircle leftCircle = MacroStabilityInwardsSlidingCircleTestFactory.Create(); MacroStabilityInwardsSlice[] slices = { MacroStabilityInwardsSliceTestFactory.CreateSlice() }; var original = new MacroStabilityInwardsSlidingCurve(leftCircle, rightCircle, slices, random.NextDouble(), random.NextDouble()); // Call object clone = original.Clone(); // Assert CoreCloneAssert.AreObjectClones(original, clone, MacroStabilityInwardsCloneAssert.AreClones); }
public void Constructor_ConstructionPropertiesWithoutValuesSet_PropertiesAreDefault() { // Setup var slidingCurve = new MacroStabilityInwardsSlidingCurve(MacroStabilityInwardsSlidingCircleTestFactory.Create(), MacroStabilityInwardsSlidingCircleTestFactory.Create(), new MacroStabilityInwardsSlice[0], 0, 0); var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(MacroStabilityInwardsGridTestFactory.Create(), MacroStabilityInwardsGridTestFactory.Create(), new RoundedDouble[0]); // Call var output = new MacroStabilityInwardsOutput(slidingCurve, slipPlane, new MacroStabilityInwardsOutput.ConstructionProperties()); // Assert Assert.IsNaN(output.FactorOfStability); Assert.IsNaN(output.ForbiddenZonesXEntryMin); Assert.IsNaN(output.ForbiddenZonesXEntryMax); }
public void Constructor_ConstructionPropertiesNull_ThrowsArgumentNullException() { // Setup var slidingCurve = new MacroStabilityInwardsSlidingCurve(MacroStabilityInwardsSlidingCircleTestFactory.Create(), MacroStabilityInwardsSlidingCircleTestFactory.Create(), new MacroStabilityInwardsSlice[0], 0, 0); var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(MacroStabilityInwardsGridTestFactory.Create(), MacroStabilityInwardsGridTestFactory.Create(), new RoundedDouble[0]); // Call TestDelegate call = () => new MacroStabilityInwardsOutput(slidingCurve, slipPlane, null); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("properties", exception.ParamName); }
public void Constructor_ExpectedValues() { // Setup var slidingCurve = new MacroStabilityInwardsSlidingCurve(MacroStabilityInwardsSlidingCircleTestFactory.Create(), MacroStabilityInwardsSlidingCircleTestFactory.Create(), new MacroStabilityInwardsSlice[0], 0, 0); var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(MacroStabilityInwardsGridTestFactory.Create(), MacroStabilityInwardsGridTestFactory.Create(), new RoundedDouble[0]); var random = new Random(21); double factorOfStability = random.NextDouble(); double zValue = random.NextDouble(); double xEntryMin = random.NextDouble(); double xEntryMax = random.NextDouble(); var properties = new MacroStabilityInwardsOutput.ConstructionProperties { FactorOfStability = factorOfStability, ForbiddenZonesXEntryMin = xEntryMin, ForbiddenZonesXEntryMax = xEntryMax }; // Call var output = new MacroStabilityInwardsOutput(slidingCurve, slipPlane, properties); // Assert Assert.IsInstanceOf <CloneableObservable>(output); Assert.IsInstanceOf <ICalculationOutput>(output); Assert.AreSame(slidingCurve, output.SlidingCurve); Assert.AreSame(slipPlane, output.SlipPlane); Assert.AreEqual(factorOfStability, output.FactorOfStability); Assert.AreEqual(xEntryMin, output.ForbiddenZonesXEntryMin); Assert.AreEqual(xEntryMax, output.ForbiddenZonesXEntryMax); }