public void ParseGpsDirectory_ValidDirectory_LatLongMetadata() { var gpsDirectory = new GpsDirectory(); var photo = new Photo(""); var gpsReference = "N"; var gpsRationalArr = new Rational[3] { new Rational(1, 1), new Rational(60, 1), new Rational(3600, 1) }; gpsDirectory.Set(GpsDirectory.TagLatitudeRef, gpsReference); gpsDirectory.Set(GpsDirectory.TagLatitude, gpsRationalArr); gpsDirectory.Set(GpsDirectory.TagLongitudeRef, gpsReference); gpsDirectory.Set(GpsDirectory.TagLongitude, gpsRationalArr); gpsDirectory.Parse(photo); var actualLatitude = photo.Latitude; var actualLongitude = photo.Longitude; var expectedLatitude = MetadataConverter.DegreesMinutesSecondsToDecimalDegrees(gpsRationalArr, gpsReference); var expectedLongitude = MetadataConverter.DegreesMinutesSecondsToDecimalDegrees(gpsRationalArr, gpsReference); Assert.Equal(expectedLatitude, actualLatitude); Assert.Equal(expectedLongitude, actualLongitude); }
public void ParseGpsDirectory_NullDirectory_NoMetadata() { GpsDirectory gpsDirectory = null; var photo = new Photo(""); gpsDirectory.Parse(photo); Assert.Null(photo.Latitude); Assert.Null(photo.Longitude); Assert.Null(photo.AltitudeReference); Assert.Null(photo.Altitude); }
public void ParseGpsDirectory_ValidDirectory_AltMetadata() { var gpsDirectory = new GpsDirectory(); var photo = new Photo(""); var gpsAltBit = 0; short gpsAlt = 50; gpsDirectory.Set(GpsDirectory.TagAltitudeRef, gpsAltBit); gpsDirectory.Set(GpsDirectory.TagAltitude, gpsAlt); gpsDirectory.Parse(photo); var actualAltitudeRef = photo.AltitudeReference; var actualAltitude = photo.Altitude; var expectedAltitudeRef = "Sea level"; Assert.Equal(expectedAltitudeRef, actualAltitudeRef); Assert.Equal(gpsAlt, actualAltitude); }