Skip to content

Commit

Permalink
add reset test
Browse files Browse the repository at this point in the history
  • Loading branch information
Scretch9 committed Jan 4, 2024
1 parent ab4916e commit 49c803d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/FieldElementSubsystems.Test/Point/PointTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,33 @@ public void Test_Default_Position()
Assert.Equal(GenericPointPosition.NoEndPosition, point.PointState.PointPosition);
}

[Fact]
public async Task Test_Reset()
{
// Arrange
var (point, pointTask, connection, cancel) = CreateDefaultPoint(true, new GenericPointState(null, GenericPointPosition.NoEndPosition, GenericDegradedPointPosition.NotApplicable, GenericAbilityToMove.AbleToMove));

connection
.SetupSequence(m => m.ReceiveMovePointCommand(It.IsAny<CancellationToken>()))
.Returns(() =>
{
point.Reset();
return Task.FromResult(GenericPointPosition.Left);
})
.Returns(() =>
{
cancel.Cancel();
return new TaskCompletionSource<GenericPointPosition>().Task;
});


// Act
await pointTask();

// Assert
connection.Verify(v => v.InitializeConnection(It.IsAny<GenericPointState>(), It.IsAny<bool>(), It.IsAny<bool>(),It.IsAny<CancellationToken>()), Times.Exactly(2));
}

[Fact]
public async Task Test_TimeoutLeft()
{
Expand Down

0 comments on commit 49c803d

Please sign in to comment.