public void MatchesHeaderContainingSignature() { var format = new ConcreteFileFormat(new byte[] { 0x6F, 0x3C }, "example/sim", ""); var header = new byte[] { 0x6F, 0x3c, 0xFF, 0xFA }; Assert.True(format.IsMatch(header)); }
public void GetHashCodeIsBasedOnSignature() { var first = new ConcreteFileFormat(new byte[] { 0x01 }, "example/one", "1"); var second = new ConcreteFileFormat(new byte[] { 0x01 }, "example/two", "2"); Assert.Equal(first.GetHashCode(), second.GetHashCode()); }
public void EqualityIsBasedOnSignature() { var first = new ConcreteFileFormat(new byte[] { 0x01 }, "example/one", "1"); var second = new ConcreteFileFormat(new byte[] { 0x01 }, "example/two", "2"); Assert.Equal(first, second); }
public void DoesNotMatchDifferentHeader(byte[] header) { var format = new ConcreteFileFormat(new byte[] { 0x6F, 0x3C }, "example/sim", ""); using var ms = new MemoryStream(header); var result = format.IsMatch(ms); Assert.False(result); }
public void MatchesHeaderContainingSignature() { var format = new ConcreteFileFormat(new byte[] { 0x6F, 0x3C }, "example/sim", ""); var header = new byte[] { 0x6F, 0x3c, 0xFF, 0xFA }; using var ms = new MemoryStream(header); var result = format.IsMatch(ms); Assert.True(result); }
public void DoesNotMatchDifferentHeader(byte[] header) { var format = new ConcreteFileFormat(new byte[] { 0x6F, 0x3C }, "example/sim", ""); Assert.False(format.IsMatch(header)); }