Crack Calculator was added
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using NUnit.Framework;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace StructureHelperTests.UnitTests.Calcuators
|
||||
{
|
||||
internal class FindParameterTest
|
||||
{
|
||||
[TestCase(0d, 1d, 0.5d, 0.5d)]
|
||||
[TestCase(0d, 10d, 5d, 5d)]
|
||||
public void Run_ShouldPass_Valid(double startValue, double EndValue, double predicateValue, double expectedValue)
|
||||
{
|
||||
//Arrange
|
||||
var calculator = new FindParameterCalculator()
|
||||
{
|
||||
StartValue = startValue,
|
||||
EndValue = EndValue,
|
||||
Predicate = x => x > predicateValue
|
||||
};
|
||||
//Act
|
||||
calculator.Run();
|
||||
var result = calculator.Result as FindParameterResult;
|
||||
//Assert
|
||||
Assert.NotNull(result);
|
||||
Assert.IsTrue(result.IsValid);
|
||||
Assert.AreEqual(predicateValue, expectedValue, 0.001d);
|
||||
}
|
||||
[TestCase(0d, 1d, 5d, 5d, false)]
|
||||
[TestCase(0d, 10d, 15d, 15d, false)]
|
||||
public void Run_ShouldPass_NotValid(double startValue, double EndValue, double predicateValue, double expectedValue, bool isValid)
|
||||
{
|
||||
//Arrange
|
||||
var calculator = new FindParameterCalculator()
|
||||
{
|
||||
StartValue = startValue,
|
||||
EndValue = EndValue,
|
||||
Predicate = x => x > predicateValue
|
||||
};
|
||||
//Act
|
||||
calculator.Run();
|
||||
var result = calculator.Result as FindParameterResult;
|
||||
//Assert
|
||||
Assert.NotNull(result);
|
||||
Assert.IsTrue(result.IsValid == isValid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
@@ -49,10 +49,12 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
//Arrange
|
||||
ProgramSetting.NatSystem = NatSystems.RU;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var mainBlock = new RectanglePrimitive() { CenterX = centerX, CenterY = centerY, Width = width, Height = height, HeadMaterial = material };
|
||||
var mainBlock = new RectanglePrimitive() { Width = width, Height = height, HeadMaterial = material };
|
||||
mainBlock.Center.X = centerX;
|
||||
mainBlock.Center.Y = centerY;
|
||||
mainBlock.VisualProperty.ZIndex = 0;
|
||||
var opening = new RectanglePrimitive()
|
||||
{ CenterX = 0d, CenterY = 0d, Width = 0.3d, Height = 0.2d,
|
||||
{ Width = 0.3d, Height = 0.2d,
|
||||
HeadMaterial = material, Triangulate = triangOpening,
|
||||
ClearUnderlying = true};
|
||||
opening.VisualProperty.ZIndex = 1;
|
||||
@@ -75,12 +77,12 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
//Arrange
|
||||
ProgramSetting.NatSystem = NatSystems.RU;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var mainBlock = new RectanglePrimitive() { CenterX = centerX, CenterY = centerY, Width = width, Height = height, HeadMaterial = material };
|
||||
var mainBlock = new RectanglePrimitive() {Width = width, Height = height, HeadMaterial = material };
|
||||
mainBlock.Center.X = centerX;
|
||||
mainBlock.Center.Y = centerY;
|
||||
mainBlock.VisualProperty.ZIndex = 0;
|
||||
var opening = new CirclePrimitive()
|
||||
{
|
||||
CenterX = 0d,
|
||||
CenterY = 0d,
|
||||
Diameter = 0.3d,
|
||||
HeadMaterial = material,
|
||||
Triangulate = triangOpening,
|
||||
@@ -106,12 +108,12 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
//Arrange
|
||||
ProgramSetting.NatSystem = NatSystems.RU;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var mainBlock = new CirclePrimitive() { CenterX = centerX, CenterY = centerY, Diameter = diameter, HeadMaterial = material };
|
||||
var mainBlock = new CirclePrimitive() { Diameter = diameter, HeadMaterial = material };
|
||||
mainBlock.Center.X = centerX;
|
||||
mainBlock.Center.Y = centerY;
|
||||
mainBlock.VisualProperty.ZIndex = 0;
|
||||
var opening = new RectanglePrimitive()
|
||||
{
|
||||
CenterX = 0d,
|
||||
CenterY = 0d,
|
||||
Width = 0.3d,
|
||||
Height = 0.2d,
|
||||
HeadMaterial = material,
|
||||
|
||||
Reference in New Issue
Block a user