Change curvature calculator
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve.Factories;
|
||||
|
||||
namespace StructureHelperTests.UnitTests.Calcuators
|
||||
{
|
||||
[TestFixture]
|
||||
public class LimitCurveLogicTests
|
||||
{
|
||||
[Test]
|
||||
public void GetPoints_ValidPoints_ReturnsTransformedPoints()
|
||||
{
|
||||
// Arrange
|
||||
var getPredicateLogic = new Mock<IGetPredicateLogic>();
|
||||
getPredicateLogic.Setup(p => p.GetPredicate()).Returns(point => point.X >= 0.5d);//
|
||||
|
||||
var limitCurveLogic = new LimitCurveLogic(getPredicateLogic.Object);
|
||||
|
||||
|
||||
var inputPoints = new List<IPoint2D>
|
||||
{
|
||||
new Point2D { X = 1, Y = 2 },
|
||||
new Point2D { X = 3, Y = 4 }
|
||||
// Add more points as needed
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = limitCurveLogic.GetPoints(inputPoints);
|
||||
|
||||
// Assert
|
||||
Assert.That(result, Is.Not.Null);
|
||||
Assert.That(result.Count, Is.EqualTo(inputPoints.Count));
|
||||
for (int i = 0; i < inputPoints.Count; i++)
|
||||
{
|
||||
Assert.That(result[i].X, Is.EqualTo(0.5d).Within(0.01d));
|
||||
Assert.That(result[i].Y, Is.EqualTo(inputPoints[i].Y / inputPoints[i].X * 0.5d).Within(0.01d));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user