Skip to content

Commit

Permalink
test(validation): add missing tests for ActiveRunway equality
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyTWF committed Jan 29, 2021
1 parent c46d211 commit 30afdb7
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/CompilerTest/Model/ActiveRunwayTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Xunit;
using System;
using Xunit;
using Compiler.Model;
using CompilerTest.Bogus.Factory;

Expand Down Expand Up @@ -46,5 +47,22 @@ public void TestItCompiles()
this.activeRunway.GetCompileData(new SectorElementCollection())
);
}

[Theory]
[InlineData("ABC", "DEF", 0, false)] // All different
[InlineData("EGBB", "34", 1, false)] // Different identifier
[InlineData("EGCC", "33", 1, false)] // Different airport
[InlineData("EGBB", "33", 0, false)] // Different mode
[InlineData("EGBB", "33", 1, true)] // All the same
public void TestEquality(string icao, string identifier, int mode, bool expected)
{
Assert.Equal(expected, activeRunway.Equals(ActiveRunwayFactory.Make(icao, identifier, mode)));
}

[Fact]
public void TestHash()
{
Assert.Equal(HashCode.Combine("33", "EGBB", 1), activeRunway.GetHashCode());
}
}
}

0 comments on commit 30afdb7

Please sign in to comment.