示例#1
0
        public void ReadNext_EmptyTagList()
        {
            var reader = new ExifAttributeReader(null, new List <IExifAttributeParser>());

            Assert.IsNull(reader.Read());
            Assert.IsNull(reader.Read());
        }
示例#2
0
        public void ReadNext_OneTag()
        {
            var reader = new ExifAttributeReader(null, new List <IExifAttributeParser>
            {
                new AttributeParserMock(new Attribute("test", new IntValue(1), AttributeSource.Metadata)),
            });

            var attr = reader.Read();

            Assert.AreEqual("test", attr.Name);
            Assert.AreEqual(AttributeSource.Metadata, attr.Source);
            Assert.AreEqual(1, ((IntValue)attr.Value).Value);

            Assert.IsNull(reader.Read());
        }
示例#3
0
        public void ReadNext_NullAttributeInTheMiddle()
        {
            var reader = new ExifAttributeReader(null, new List <IExifAttributeParser>
            {
                new AttributeParserMock(new Attribute("test1", new IntValue(1), AttributeSource.Metadata)),
                new AttributeParserMock(null),
                new AttributeParserMock(new Attribute("test3", new IntValue(3), AttributeSource.Metadata)),
            });

            var attr = reader.Read();

            Assert.AreEqual("test1", attr.Name);
            Assert.AreEqual(AttributeSource.Metadata, attr.Source);
            Assert.AreEqual(1, ((IntValue)attr.Value).Value);

            // it will skip the null attribute
            attr = reader.Read();
            Assert.AreEqual("test3", attr.Name);
            Assert.AreEqual(AttributeSource.Metadata, attr.Source);
            Assert.AreEqual(3, ((IntValue)attr.Value).Value);

            Assert.IsNull(reader.Read());
        }