Add calculators saving
This commit is contained in:
@@ -51,7 +51,7 @@ namespace StructureHelperTests.UnitTests.Ndms
|
||||
public void Check_RebarPrimitiveFailsCheck_ReturnsFalseAndAppendsCheckResult()
|
||||
{
|
||||
// Arrange
|
||||
var rebarMock = new Mock<IRebarPrimitive>();
|
||||
var rebarMock = new Mock<IRebarNdmPrimitive>();
|
||||
_mockHasPrimitives.Setup(x => x.Primitives).Returns(new List<INdmPrimitive> { rebarMock.Object });
|
||||
_mockCheckRebarPrimitiveLogic.Setup(x => x.Check()).Returns(false);
|
||||
_mockCheckRebarPrimitiveLogic.Setup(x => x.CheckResult).Returns("Rebar check failed\n");
|
||||
@@ -68,7 +68,7 @@ namespace StructureHelperTests.UnitTests.Ndms
|
||||
public void Check_RebarPrimitiveHasNoHostPrimitive_ReturnsFalseAndLogsError()
|
||||
{
|
||||
// Arrange
|
||||
var rebarMock = new Mock<IRebarPrimitive>();
|
||||
var rebarMock = new Mock<IRebarNdmPrimitive>();
|
||||
var hostPrimitiveMock = new Mock<INdmPrimitive>();
|
||||
|
||||
rebarMock.Setup(x => x.HostPrimitive).Returns(hostPrimitiveMock.Object);
|
||||
@@ -91,7 +91,7 @@ namespace StructureHelperTests.UnitTests.Ndms
|
||||
public void Check_AllPrimitivesValid_ReturnsTrue()
|
||||
{
|
||||
// Arrange
|
||||
var rebarMock = new Mock<IRebarPrimitive>();
|
||||
var rebarMock = new Mock<IRebarNdmPrimitive>();
|
||||
var hostPrimitiveMock = new Mock<INdmPrimitive>();
|
||||
|
||||
rebarMock.Setup(x => x.HostPrimitive).Returns(hostPrimitiveMock.Object);
|
||||
|
||||
@@ -19,14 +19,14 @@ namespace StructureHelperTests.UnitTests.Ndms
|
||||
[TestFixture]
|
||||
public class CheckRebarPrimitiveLogicTests
|
||||
{
|
||||
private Mock<IRebarPrimitive> _mockRebarPrimitive;
|
||||
private Mock<IRebarNdmPrimitive> _mockRebarPrimitive;
|
||||
private Mock<IShiftTraceLogger> _mockTraceLogger;
|
||||
private CheckRebarPrimitiveLogic _checkRebarPrimitiveLogic;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
_mockRebarPrimitive = new Mock<IRebarPrimitive>();
|
||||
_mockRebarPrimitive = new Mock<IRebarNdmPrimitive>();
|
||||
_mockTraceLogger = new Mock<IShiftTraceLogger>();
|
||||
|
||||
_checkRebarPrimitiveLogic = new CheckRebarPrimitiveLogic(_mockTraceLogger.Object)
|
||||
|
||||
@@ -56,7 +56,7 @@ public class CheckTupleCalculatorInputDataTests
|
||||
// Arrange
|
||||
_checkTupleCalculatorInputData.InputData = new TupleCrackInputData
|
||||
{
|
||||
Primitives = new List<INdmPrimitive> { new EllipsePrimitive() }, // Assuming at least one valid primitive
|
||||
Primitives = new List<INdmPrimitive> { new EllipseNdmPrimitive() }, // Assuming at least one valid primitive
|
||||
UserCrackInputData = null
|
||||
};
|
||||
|
||||
@@ -74,7 +74,7 @@ public class CheckTupleCalculatorInputDataTests
|
||||
// Arrange
|
||||
_checkTupleCalculatorInputData.InputData = new TupleCrackInputData
|
||||
{
|
||||
Primitives = new List<INdmPrimitive> { new EllipsePrimitive() }, // Assuming at least one valid primitive
|
||||
Primitives = new List<INdmPrimitive> { new EllipseNdmPrimitive() }, // Assuming at least one valid primitive
|
||||
UserCrackInputData = new UserCrackInputData() // Assuming this is valid
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
||||
{
|
||||
// Arrange
|
||||
var mockInputFactory = new Mock<IRebarCrackInputDataFactory>();
|
||||
var rebar = new RebarPrimitive();
|
||||
var rebar = new RebarNdmPrimitive();
|
||||
var inputData = new TupleCrackInputData();
|
||||
var rebarCrackInputData = new RebarCrackCalculatorInputData();
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
||||
|
||||
var factory = new RebarCalulatorsFactory(mockInputFactory.Object)
|
||||
{
|
||||
Rebars = new List<RebarPrimitive> { rebar },
|
||||
Rebars = new List<RebarNdmPrimitive> { rebar },
|
||||
InputData = inputData,
|
||||
LongLength = 10.0,
|
||||
ShortLength = 5.0,
|
||||
@@ -48,8 +48,8 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
||||
{
|
||||
// Arrange
|
||||
var mockInputFactory = new Mock<IRebarCrackInputDataFactory>();
|
||||
var rebar1 = new RebarPrimitive();
|
||||
var rebar2 = new RebarPrimitive();
|
||||
var rebar1 = new RebarNdmPrimitive();
|
||||
var rebar2 = new RebarNdmPrimitive();
|
||||
var inputData = new TupleCrackInputData();
|
||||
var rebarInputData1 = new RebarCrackCalculatorInputData();
|
||||
var rebarInputData2 = new RebarCrackCalculatorInputData();
|
||||
@@ -64,7 +64,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
||||
|
||||
var factory = new RebarCalulatorsFactory(mockInputFactory.Object)
|
||||
{
|
||||
Rebars = new List<RebarPrimitive> { rebar1, rebar2 },
|
||||
Rebars = new List<RebarNdmPrimitive> { rebar1, rebar2 },
|
||||
InputData = inputData,
|
||||
LongLength = 20.0,
|
||||
ShortLength = 10.0,
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
||||
_mockRebarStressCalculator.Setup(x => x.Run());
|
||||
_mockRebarStressCalculator.Setup(x => x.Result).Returns(mockRebarStressResult);
|
||||
|
||||
var mockRebarPrimitive = new Mock<IRebarPrimitive>();
|
||||
var mockRebarPrimitive = new Mock<IRebarNdmPrimitive>();
|
||||
var mockRebarCrackInputData = new Mock<IRebarCrackInputData>();
|
||||
|
||||
_rebarStressResultLogic.RebarPrimitive = mockRebarPrimitive.Object;
|
||||
@@ -64,7 +64,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
||||
_mockRebarStressCalculator.Setup(x => x.Run());
|
||||
_mockRebarStressCalculator.Setup(x => x.Result).Returns(mockRebarStressResult);
|
||||
|
||||
var mockRebarPrimitive = new Mock<IRebarPrimitive>();
|
||||
var mockRebarPrimitive = new Mock<IRebarNdmPrimitive>();
|
||||
var mockRebarCrackInputData = new Mock<IRebarCrackInputData>();
|
||||
|
||||
_rebarStressResultLogic.RebarPrimitive = mockRebarPrimitive.Object;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
||||
|
||||
var solver = new TupleRebarsCrackSolver(mockCalculatorFactory.Object)
|
||||
{
|
||||
Rebars = new List<RebarPrimitive>(),
|
||||
Rebars = new List<RebarNdmPrimitive>(),
|
||||
InputData = new TupleCrackInputData(),
|
||||
LongLength = 10.0,
|
||||
ShortLength = 5.0,
|
||||
@@ -60,7 +60,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
||||
|
||||
var solver = new TupleRebarsCrackSolver(mockCalculatorFactory.Object)
|
||||
{
|
||||
Rebars = new List<RebarPrimitive>(),
|
||||
Rebars = new List<RebarNdmPrimitive>(),
|
||||
InputData = new TupleCrackInputData(),
|
||||
LongLength = 10.0,
|
||||
ShortLength = 5.0,
|
||||
|
||||
@@ -41,11 +41,12 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
.Returns(new Material());
|
||||
|
||||
IPoint2D center = new Point2D { X = centerX, Y = centerY };
|
||||
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = angle };
|
||||
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height};
|
||||
var options = new RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision)
|
||||
{
|
||||
triangulationOptions = new TriangulationOptions() { LimiteState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm },
|
||||
HeadMaterial = materialMock.Object
|
||||
HeadMaterial = materialMock.Object,
|
||||
RotationAngle = angle
|
||||
};
|
||||
var logic = new RectangleTriangulationLogic(options);
|
||||
//Act
|
||||
@@ -66,7 +67,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
//Arrange
|
||||
ProgramSetting.NatSystem = NatSystems.RU;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var mainBlock = new RectanglePrimitive()
|
||||
var mainBlock = new RectangleNdmPrimitive()
|
||||
{
|
||||
Width = width,
|
||||
Height = height,
|
||||
@@ -75,7 +76,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
mainBlock.Center.X = centerX;
|
||||
mainBlock.Center.Y = centerY;
|
||||
mainBlock.VisualProperty.ZIndex = 0;
|
||||
var opening = new RectanglePrimitive()
|
||||
var opening = new RectangleNdmPrimitive()
|
||||
{
|
||||
Width = 0.3d,
|
||||
Height = 0.2d
|
||||
@@ -109,7 +110,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
//Arrange
|
||||
ProgramSetting.NatSystem = NatSystems.RU;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var mainBlock = new RectanglePrimitive()
|
||||
var mainBlock = new RectangleNdmPrimitive()
|
||||
{
|
||||
Width = width,
|
||||
Height = height
|
||||
@@ -118,7 +119,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
mainBlock.Center.X = centerX;
|
||||
mainBlock.Center.Y = centerY;
|
||||
mainBlock.VisualProperty.ZIndex = 0;
|
||||
var opening = new EllipsePrimitive()
|
||||
var opening = new EllipseNdmPrimitive()
|
||||
{
|
||||
Width = 0.3d
|
||||
};
|
||||
@@ -155,12 +156,12 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
//Arrange
|
||||
ProgramSetting.NatSystem = NatSystems.RU;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var mainBlock = new EllipsePrimitive() { Width = diameter};
|
||||
var mainBlock = new EllipseNdmPrimitive() { Width = diameter};
|
||||
mainBlock.NdmElement.HeadMaterial = material;
|
||||
mainBlock.Center.X = centerX;
|
||||
mainBlock.Center.Y = centerY;
|
||||
mainBlock.VisualProperty.ZIndex = 0;
|
||||
var opening = new RectanglePrimitive()
|
||||
var opening = new RectangleNdmPrimitive()
|
||||
{
|
||||
Width = 0.3d,
|
||||
Height = 0.2d
|
||||
|
||||
Reference in New Issue
Block a user