public void ValidateHeading(string nmea, double expectedHeading) { GpsParser parser = new GpsParser(); Sentence sentence = Sentence.Parse(nmea); Message message = parser.Parse(sentence); message.Sentence.ShouldEqual(sentence); IProvideTrajectory provideTrajectory = message.ValueAs<IProvideTrajectory>(); provideTrajectory.CurrentHeading.Value.ShouldEqual(expectedHeading); }
public void Parsing13Parts(string nmea, int expectedParts, double latitude, char latHemisphere, double longitude, char longHemisphere) { GpsParser parser = new GpsParser(); Sentence sentence = Sentence.Parse(nmea); sentence.Id.ShouldEqual("$GPRMC"); sentence.Parts.Length.ShouldEqual(expectedParts); Message message = parser.Parse(sentence); message.Sentence.ShouldEqual(sentence); IProvideGeoPosition provideGeoPosition = message.ValueAs<IProvideGeoPosition>(); provideGeoPosition.CurrentLocation.Latitude.Value.ShouldEqualWithinPrecision(latitude, 10); provideGeoPosition.CurrentLocation.Latitude.Hemisphere.ShouldEqual(latHemisphere); provideGeoPosition.CurrentLocation.Longitude.Value.ShouldEqualWithinPrecision(longitude, 10); provideGeoPosition.CurrentLocation.Longitude.Hemisphere.ShouldEqual(longHemisphere); }