public void ToStringMethod() { var directory = new ExifIfd0Directory(); Assert.Equal("Exif IFD0 Directory (0 tags)", directory.ToString()); directory.Set(1, "Tag 1"); Assert.Equal("Exif IFD0 Directory (1 tag)", directory.ToString()); directory.Set(2, "Tag 2"); Assert.Equal("Exif IFD0 Directory (2 tags)", directory.ToString()); }
public void TestYResolutionDescription() { var directory = new ExifIfd0Directory(); directory.Set(ExifDirectoryBase.TagYResolution, new Rational(50, 1)); // 3 is for 'cm' directory.Set(ExifDirectoryBase.TagResolutionUnit, 3); var descriptor = new ExifIfd0Descriptor(directory); Assert.Equal("50 dots per cm", descriptor.GetDescription(ExifDirectoryBase.TagYResolution)); }
public void TestXResolutionDescription() { var directory = new ExifIfd0Directory(); directory.Set(ExifDirectoryBase.TagXResolution, new Rational(72, 1)); // 2 is for 'Inch' directory.Set(ExifDirectoryBase.TagResolutionUnit, 2); var descriptor = new ExifIfd0Descriptor(directory); Assert.Equal("72 dots per inch", descriptor.GetDescription(ExifDirectoryBase.TagXResolution)); }
public void ParseIfd0Directory_ValidDirectory_AllMetadata() { var ifd0Directory = new ExifIfd0Directory(); var photo = new Photo(""); var make = "TestMake"; var model = "TestModel"; var dateTime = DateTime.Today; ifd0Directory.Set(ExifIfd0Directory.TagMake, make); ifd0Directory.Set(ExifIfd0Directory.TagModel, model); ifd0Directory.Set(ExifIfd0Directory.TagDateTime, dateTime); ifd0Directory.Parse(photo); var actualMake = photo.Make; var actualModel = photo.Model; var actualDateTime = photo.DateTime; Assert.Equal(make, actualMake); Assert.Equal(model, actualModel); Assert.Equal(dateTime, actualDateTime); }
public void Parse_InvalidDateFormat() { var dir = new ExifIfd0Directory(); dir.Set(ExifIfd0Directory.TagDateTimeOriginal, " : : : : "); var metadata = new Mock <IExifMetadata>(); metadata.Setup(mock => mock.GetDirectoryOfType <ExifIfd0Directory>()).Returns(dir); var parser = new ExifAttributeParser <ExifIfd0Directory>("test", ExifIfd0Directory.TagDateTimeOriginal, AttributeType.DateTime); var attr = parser.Parse(metadata.Object); Assert.IsNull(attr); }