From 30afdb7d98ce35d84745edfc1c356817c049b1c4 Mon Sep 17 00:00:00 2001 From: Andy Ford Date: Fri, 29 Jan 2021 17:38:37 +0000 Subject: [PATCH] test(validation): add missing tests for ActiveRunway equality --- tests/CompilerTest/Model/ActiveRunwayTest.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/CompilerTest/Model/ActiveRunwayTest.cs b/tests/CompilerTest/Model/ActiveRunwayTest.cs index 3d02cf14..03b5d525 100644 --- a/tests/CompilerTest/Model/ActiveRunwayTest.cs +++ b/tests/CompilerTest/Model/ActiveRunwayTest.cs @@ -1,4 +1,5 @@ -using Xunit; +using System; +using Xunit; using Compiler.Model; using CompilerTest.Bogus.Factory; @@ -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()); + } } }