Skip to content

Commit

Permalink
Split tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sandermvanvliet committed Aug 4, 2023
1 parent dfd4245 commit 97e01bc
Showing 1 changed file with 52 additions and 10 deletions.
62 changes: 52 additions & 10 deletions test/RoadCaptain.Tests.Unit/PlannedRouteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,53 @@ public void GivenNextSegmentOnSecondLoop_SegmentSequenceIndexIsTwo()
_plannedRoute.OnLeadIn.Should().BeFalse();
}

[Fact]
public void GivenNextSegmentOnSecondLoop_CurrentSegmentIsSegment2()
{
_plannedRoute.EnteredSegment("seg-0");
_plannedRoute.EnteredSegment("seg-1");
_plannedRoute.EnteredSegment("seg-2");
_plannedRoute.EnteredSegment("seg-3");
_plannedRoute.EnteredSegment("seg-4");
_plannedRoute.EnteredSegment(_plannedRoute.NextSegmentId!);

_plannedRoute
.CurrentSegmentSequence!
.SegmentId
.Should()
.Be("seg-2");
}

[Fact]
public void GivenNextSegmentOnSecondLoop_NextSegmentIsSegment3()
{
_plannedRoute.EnteredSegment("seg-0");
_plannedRoute.EnteredSegment("seg-1");
_plannedRoute.EnteredSegment("seg-2");
_plannedRoute.EnteredSegment("seg-3");
_plannedRoute.EnteredSegment("seg-4");
_plannedRoute.EnteredSegment(_plannedRoute.NextSegmentId!);

_plannedRoute
.NextSegmentSequence!
.SegmentId
.Should()
.Be("seg-3");
}

[Fact]
public void GivenNextSegmentOnSecondLoop_RouteIsNotOnLeadIn()
{
_plannedRoute.EnteredSegment("seg-0");
_plannedRoute.EnteredSegment("seg-1");
_plannedRoute.EnteredSegment("seg-2");
_plannedRoute.EnteredSegment("seg-3");
_plannedRoute.EnteredSegment("seg-4");
_plannedRoute.EnteredSegment(_plannedRoute.NextSegmentId!);

_plannedRoute.OnLeadIn.Should().BeFalse();
}

public PlannedRouteTests()
{
_plannedRoute = new PlannedRoute
Expand All @@ -129,16 +176,11 @@ public PlannedRouteTests()
World = new World { Id = "watopia", ZwiftId = ZwiftWorldId.Watopia },
RouteSegmentSequence =
{
new SegmentSequence(direction: SegmentDirection.AtoB, nextSegmentId: "seg-1", segmentId: "seg-0",
type: SegmentSequenceType.LeadIn, turnToNextSegment: TurnDirection.GoStraight),
new SegmentSequence(direction: SegmentDirection.AtoB, nextSegmentId: "seg-2", segmentId: "seg-1",
type: SegmentSequenceType.LeadIn, turnToNextSegment: TurnDirection.GoStraight),
new SegmentSequence(direction: SegmentDirection.AtoB, nextSegmentId: "seg-3", segmentId: "seg-2",
type: SegmentSequenceType.LoopStart, turnToNextSegment: TurnDirection.GoStraight),
new SegmentSequence(direction: SegmentDirection.AtoB, nextSegmentId: "seg-4", segmentId: "seg-3",
type: SegmentSequenceType.Loop, turnToNextSegment: TurnDirection.GoStraight),
new SegmentSequence(direction: SegmentDirection.AtoB, nextSegmentId: "seg-2", segmentId: "seg-4",
type: SegmentSequenceType.LoopEnd, turnToNextSegment: TurnDirection.GoStraight),
new SegmentSequence(direction: SegmentDirection.AtoB, segmentId: "seg-0", nextSegmentId: "seg-1", type: SegmentSequenceType.LeadIn, turnToNextSegment: TurnDirection.GoStraight),
new SegmentSequence(direction: SegmentDirection.AtoB, segmentId: "seg-1", nextSegmentId: "seg-2", type: SegmentSequenceType.LeadIn, turnToNextSegment: TurnDirection.GoStraight),
new SegmentSequence(direction: SegmentDirection.AtoB, segmentId: "seg-2", nextSegmentId: "seg-3", type: SegmentSequenceType.LoopStart, turnToNextSegment: TurnDirection.GoStraight),
new SegmentSequence(direction: SegmentDirection.AtoB, segmentId: "seg-3", nextSegmentId: "seg-4", type: SegmentSequenceType.Loop, turnToNextSegment: TurnDirection.GoStraight),
new SegmentSequence(direction: SegmentDirection.AtoB, segmentId: "seg-4", nextSegmentId: "seg-2", type: SegmentSequenceType.LoopEnd, turnToNextSegment: TurnDirection.GoStraight),
}
};
}
Expand Down

0 comments on commit 97e01bc

Please sign in to comment.