示例#1
0
        public void WhenPassedAnInvalidID3v2FileHeader_ThrowsAnInvalidHeaderException()
        {
            byte[] data = new byte[] { 0x49, 0x44, 0x33 };
            FileSignatureMatcher matcher = new FileSignatureMatcher();

            var stream = new MemoryStream(data);

            var exception = Assert.ThrowsException <InvalidHeaderException>(() => matcher.FindSignature(data).Invoke(stream));

            exception.Message.Should().Be("Header is incomplete.");
            stream.Close();
        }
示例#2
0
        public void WhenPassedAnID3v2FileHeader_ReturnsAnObjectOfTypeID3v2Tags()
        {
            byte[] data = new byte[] { 0x49, 0x44, 0x33, 0, 0, 0, 0, 0, 0, 0 };
            FileSignatureMatcher matcher = new FileSignatureMatcher();

            var stream = new MemoryStream(data);

            var tags = matcher.FindSignature(data).Invoke(stream);

            tags.Should().BeOfType <ID3v2Tags>();
            stream.Close();
        }