public void Calculate_KernelWithCompleteOutput_OutputCorrectlyReturnedByCalculator() { // Setup WaternetCalculatorInput input = WaternetCalculatorInputTestFactory.CreateValidCalculatorInput(); using (new MacroStabilityInwardsKernelFactoryConfig()) { var factory = (TestMacroStabilityInwardsKernelFactory)MacroStabilityInwardsKernelWrapperFactory.Instance; WaternetKernelStub kernel = factory.LastCreatedWaternetExtremeKernel; SetCompleteKernelOutput(kernel); // Call WaternetCalculatorResult result = new TestWaternetCalculator(input, factory).Calculate(); // Assert Assert.IsNotNull(result); var expectedPhreaticLines = new List <HeadLine> { kernel.Waternet.PhreaticLine }; expectedPhreaticLines.AddRange(kernel.Waternet.HeadLines); WaternetCalculatorOutputAssert.AssertPhreaticLines(expectedPhreaticLines.ToArray(), result.PhreaticLines.ToArray()); WaternetCalculatorOutputAssert.AssertReferenceLines(kernel.Waternet.ReferenceLines.ToArray(), result.WaternetLines.ToArray()); } }
public void Create_WaternetWithPhreaticLineAndHeadLinesAndWaternetLines_ReturnWaternetCalculatorResult() { // Setup var headLine = new HeadLine { Name = "line 1", Points = { new CSharpWrapperPoint2D(0, 0), new CSharpWrapperPoint2D(1, 1) } }; var phreaticLine = new HeadLine { Name = "line 2", Points = { new CSharpWrapperPoint2D(2, 2), new CSharpWrapperPoint2D(3, 3) } }; var referenceLine = new ReferenceLine { Name = "line 3", Points = { new CSharpWrapperPoint2D(4, 4), new CSharpWrapperPoint2D(5, 5) }, AssociatedHeadLine = headLine }; var waternet = new Waternet { HeadLines = { headLine }, PhreaticLine = phreaticLine, ReferenceLines = { referenceLine } }; // Call WaternetCalculatorResult result = WaternetCalculatorResultCreator.Create(waternet); // Assert WaternetCalculatorOutputAssert.AssertPhreaticLines(new[] { phreaticLine, headLine }, result.PhreaticLines.ToArray()); WaternetCalculatorOutputAssert.AssertReferenceLines(new[] { referenceLine }, result.WaternetLines.ToArray()); }