-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Unit tests to test a function. Fixed the lights not going green…
… on multiple places
- Loading branch information
1 parent
6577550
commit 21015e8
Showing
10 changed files
with
156 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
// Global using directives | ||
global using static System.Console; | ||
global using static System.Console; | ||
global using NUnit.Framework; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using StoplichtController.Crossings.Lanes; | ||
using StoplichtController.Crossings.Lanes.Implementations; | ||
|
||
namespace StoplichtControllerTests; | ||
|
||
public class LaneWithPathTests | ||
{ | ||
LaneWithPath _laneWithPath; | ||
|
||
[SetUp] | ||
public void Setup() { _laneWithPath = new CarLane("A", "B"); } | ||
|
||
[Test] | ||
public void IntersectsWith_SamePath_ReturnsFalse() | ||
{ | ||
var otherLane = new CarLane("A", "B"); | ||
Assert.That(_laneWithPath.IntersectsWith(otherLane), Is.False); | ||
} | ||
|
||
[Test] | ||
public void IntersectsWith_DifferentPath_ReturnsTrue() | ||
{ | ||
var otherLane = new CarLane("B", "C"); | ||
Assert.That(_laneWithPath.IntersectsWith(otherLane), Is.True); | ||
} | ||
|
||
[Test] | ||
public void IntersectsWith_ReversePath_ReturnsFalse() | ||
{ | ||
var otherLane = new CarLane("B", "A"); | ||
Assert.That(_laneWithPath.IntersectsWith(otherLane), Is.False); | ||
} | ||
|
||
[Test] | ||
public void IntersectsWith_CrossesRoad_From_ReturnsTrue() | ||
{ | ||
var otherLane = new PedestrianLane("A"); | ||
Assert.That(_laneWithPath.IntersectsWith(otherLane), Is.True); | ||
} | ||
|
||
[Test] | ||
public void IntersectsWith_CrossesRoad_To_ReturnsTrue() | ||
{ | ||
var otherLane = new PedestrianLane("B"); | ||
Assert.That(_laneWithPath.IntersectsWith(otherLane), Is.True); | ||
} | ||
|
||
[Test] | ||
public void IntersectsWith_CrossesRoad_ReturnsFalse() | ||
{ | ||
var otherLane = new PedestrianLane("C"); | ||
Assert.That(_laneWithPath.IntersectsWith(otherLane), Is.False); | ||
} | ||
|
||
[Test] | ||
public void IntersectsWith_OtherLane_ReturnsTrue() | ||
{ | ||
var otherLane = new CarLane("C", "B"); | ||
Assert.That(_laneWithPath.IntersectsWith(otherLane), Is.True); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"/> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/> | ||
<PackageReference Include="NUnit" Version="4.1.0"/> | ||
<PackageReference Include="NUnit.Analyzers" Version="3.9.0"/> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="NUnit.Framework"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\StoplichtController\StoplichtController.csproj"/> | ||
</ItemGroup> | ||
|
||
</Project> |