Initial commit
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
namespace RobotNet10.GlobalPathPlanner.UnitTest;
|
||||
|
||||
public class PathPlannerOptionsTests
|
||||
{
|
||||
[Fact]
|
||||
public void PathPlannerOptions_DefaultValues_ShouldBeSet()
|
||||
{
|
||||
// Arrange & Act
|
||||
var options = new PathPlannerOptions();
|
||||
|
||||
// Assert
|
||||
Assert.Equal(0.0, options.LimitDistanceToEdge);
|
||||
Assert.Equal(0.0, options.LimitDistanceToNode);
|
||||
Assert.Equal(0.0, options.ResolutionSplit);
|
||||
Assert.Null(options.TimeOut);
|
||||
Assert.Equal(0.0, options.ChangeOrientationAngle);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PathPlannerOptions_AllProperties_ShouldBeSettable()
|
||||
{
|
||||
// Arrange & Act
|
||||
var options = new PathPlannerOptions
|
||||
{
|
||||
LimitDistanceToEdge = 1.5,
|
||||
LimitDistanceToNode = 0.5,
|
||||
ResolutionSplit = 0.2,
|
||||
TimeOut = TimeSpan.FromSeconds(10),
|
||||
ChangeOrientationAngle = 90.0
|
||||
};
|
||||
|
||||
// Assert
|
||||
Assert.Equal(1.5, options.LimitDistanceToEdge);
|
||||
Assert.Equal(0.5, options.LimitDistanceToNode);
|
||||
Assert.Equal(0.2, options.ResolutionSplit);
|
||||
Assert.NotNull(options.TimeOut);
|
||||
Assert.Equal(TimeSpan.FromSeconds(10), options.TimeOut);
|
||||
Assert.Equal(90.0, options.ChangeOrientationAngle);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PathPlannerOptions_AsRecord_ShouldSupportEquality()
|
||||
{
|
||||
// Arrange
|
||||
var options1 = new PathPlannerOptions
|
||||
{
|
||||
LimitDistanceToEdge = 1.0,
|
||||
LimitDistanceToNode = 0.3,
|
||||
ResolutionSplit = 0.1,
|
||||
ChangeOrientationAngle = 89.0
|
||||
};
|
||||
|
||||
var options2 = new PathPlannerOptions
|
||||
{
|
||||
LimitDistanceToEdge = 1.0,
|
||||
LimitDistanceToNode = 0.3,
|
||||
ResolutionSplit = 0.1,
|
||||
ChangeOrientationAngle = 89.0
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
Assert.Equal(options1, options2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PathPlannerOptions_WithDifferentValues_ShouldNotBeEqual()
|
||||
{
|
||||
// Arrange
|
||||
var options1 = new PathPlannerOptions
|
||||
{
|
||||
LimitDistanceToEdge = 1.0
|
||||
};
|
||||
|
||||
var options2 = new PathPlannerOptions
|
||||
{
|
||||
LimitDistanceToEdge = 2.0
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
Assert.NotEqual(options1, options2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PathPlannerOptions_TimeOut_CanBeNull()
|
||||
{
|
||||
// Arrange & Act
|
||||
var options = new PathPlannerOptions
|
||||
{
|
||||
TimeOut = null
|
||||
};
|
||||
|
||||
// Assert
|
||||
Assert.Null(options.TimeOut);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PathPlannerOptions_TimeOut_CanBeSet()
|
||||
{
|
||||
// Arrange & Act
|
||||
var options = new PathPlannerOptions
|
||||
{
|
||||
TimeOut = TimeSpan.FromMilliseconds(500)
|
||||
};
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(options.TimeOut);
|
||||
Assert.Equal(TimeSpan.FromMilliseconds(500), options.TimeOut);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user