public void CanParseAStartingLocation(string startingLocation) { var locationParser = new LocationParser(); RobotVector location = locationParser.Parse(startingLocation); Assert.That(location.ToString(), Is.EqualTo(startingLocation)); }
public void TestChangeDetails(string input, ChangeDetails changeDetails) { var target = new LocationParser(); var result = target.Parse(input, out var message); Assert.IsNull(message); Assert.AreEqual(changeDetails, result.ChangeDetails[0]); }
public void TestFunctions(string input, Function function) { var target = new LocationParser(); var result = target.Parse(input, out var message); Assert.IsNull(message); Assert.AreEqual(function, result.Functions[0]); }
public void TestRemarks(string input, string remarks) { var target = new LocationParser(); var result = target.Parse(input, out var message); Assert.IsNull(message); Assert.AreEqual(remarks, result.Remarks); }
public void TestChangeReason(string input, ChangeReason changeReason) { var target = new LocationParser(); var result = target.Parse(input, out var message); Assert.IsNull(message); Assert.AreEqual(changeReason, result.ChangeReason); Assert.IsTrue(result.ChangeDetails.Length == 0); }
public void TestInvalidChangeReason() { const string input = "\"P\",\"AE\",\"HAT\",\"Hatta\",\"Hatta\",\"DU\",\"--3-----\",\"RL\",\"1707\",,\"2447N 05607E\","; var target = new LocationParser(); var result = target.Parse(input, out var message); Assert.AreEqual(ChangeReason.None, result.ChangeReason); Assert.AreEqual("Invalid change reason: P", message); }
public void TestCombinedChangeDetails() { const string input = ",\"AE\",\"HAT\",\"Hatta\",\"Hatta\",\"DU\",\"--3-----\",\"RL\",\"1707\",,\"2447N 05607E\",\"@Coo@Fun@Nam\""; var target = new LocationParser(); var result = target.Parse(input, out var message); Assert.IsNull(message); Assert.IsTrue(result.ChangeDetails.Length == 3); Assert.IsTrue(result.ChangeDetails.Any(d => d == ChangeDetails.Coordinates)); Assert.IsTrue(result.ChangeDetails.Any(d => d == ChangeDetails.Function)); Assert.IsTrue(result.ChangeDetails.Any(d => d == ChangeDetails.LocationName)); Assert.IsTrue(result.ChangeDetails.All(d => d != ChangeDetails.SpellingName)); Assert.IsTrue(result.ChangeDetails.All(d => d != ChangeDetails.SubdivisionCode)); Assert.IsTrue(result.ChangeDetails.All(d => d != ChangeDetails.Status)); }
public void TestCombinedFunctions() { const string input = ",\"AE\",\"HAT\",\"Hatta\",\"Hatta\",\"DU\",\"1-3-5-7-\",\"RL\",\"1707\",,\"2447N 05607E\",\"@Coo@Fun@Nam\""; var target = new LocationParser(); var result = target.Parse(input, out var message); Assert.IsNull(message); Assert.IsTrue(result.ChangeDetails.Length == 3); Assert.IsTrue(result.Functions.Any(d => d == Function.Port)); Assert.IsTrue(result.Functions.Any(d => d == Function.RoadTerminal)); Assert.IsTrue(result.Functions.Any(d => d == Function.PostalExchangeOffice)); Assert.IsTrue(result.Functions.Any(d => d == Function.FixedTransportFunction)); Assert.IsTrue(result.Functions.All(d => d != Function.RailTerminal)); Assert.IsTrue(result.Functions.All(d => d != Function.Airport)); Assert.IsTrue(result.Functions.All(d => d != Function.MultimodalFunction)); Assert.IsTrue(result.Functions.All(d => d != Function.BorderCrossing)); }
public void TestNormalLocation(string input, string name, string spellingName) { var target = new LocationParser(); var result = target.Parse(input, out var message); Assert.IsNotNull(result); Assert.IsNull(message); Assert.AreEqual(ChangeReason.None, result.ChangeReason); Assert.IsTrue(result.ChangeDetails.Length == 0); Assert.AreEqual("AD", result.CountryId); Assert.AreEqual("ADALV", result.UNLOC); Assert.AreEqual(name, result.Name); Assert.AreEqual(spellingName, result.SpellingName); Assert.AreEqual(42.5, result.Position.Lat, 0.00001); Assert.AreEqual(1.516667, result.Position.Lng, 0.00001); Assert.IsTrue(result.Functions.Any(f => f == Function.Airport)); Assert.IsTrue(result.Functions.Any(f => f == Function.RoadTerminal)); Assert.IsTrue(result.Functions.Any(f => f == Function.MultimodalFunction)); }
public void Parse() { var location1 = LocationParser.Parse("6F1AFAA99234CB31770000140774365500000000".ToByteArray(), "YB3 03.6.10"); var location2 = LocationParser.Parse("6F56C4297C6B095931E0002C10DC745400000000".ToByteArray(), "TS 01.06.09"); var location3 = LocationParser.Parse("2640E58A7BCA3300546573740000000000000000".ToByteArray(), "YB3 03.6.10"); }