mirror of
https://github.com/SabreTools/SabreTools.Matching.git
synced 2026-02-04 05:36:06 +00:00
Rename content tests
This commit is contained in:
@@ -9,7 +9,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
public class ContentMatchSetTests
|
||||
{
|
||||
[Fact]
|
||||
public void InvalidNeedleThrowsException()
|
||||
public void InvalidNeedle_ThrowsException()
|
||||
{
|
||||
Assert.Throws<InvalidDataException>(() => new ContentMatchSet(Array.Empty<byte>(), "name"));
|
||||
Assert.Throws<InvalidDataException>(() => new ContentMatchSet(Array.Empty<byte>(), ArrayVersionMock, "name"));
|
||||
@@ -17,7 +17,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InvalidNeedlesThrowsException()
|
||||
public void InvalidNeedles_ThrowsException()
|
||||
{
|
||||
Assert.Throws<InvalidDataException>(() => new ContentMatchSet([], "name"));
|
||||
Assert.Throws<InvalidDataException>(() => new ContentMatchSet([], ArrayVersionMock, "name"));
|
||||
@@ -25,7 +25,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenericConstructorSetsNoDelegates()
|
||||
public void GenericConstructor_NoDelegates()
|
||||
{
|
||||
var needles = new List<ContentMatch> { new byte[] { 0x01, 0x02, 0x03, 0x04 } };
|
||||
var cms = new ContentMatchSet(needles, "name");
|
||||
@@ -34,7 +34,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ArrayConstructorSetsOneDelegate()
|
||||
public void ArrayConstructor_SingleDelegate()
|
||||
{
|
||||
var needles = new List<ContentMatch> { new byte[] { 0x01, 0x02, 0x03, 0x04 } };
|
||||
var cms = new ContentMatchSet(needles, ArrayVersionMock, "name");
|
||||
@@ -43,7 +43,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void StreamConstructorSetsOneDelegate()
|
||||
public void StreamConstructor_SingleDelegate()
|
||||
{
|
||||
var needles = new List<ContentMatch> { new byte[] { 0x01, 0x02, 0x03, 0x04 } };
|
||||
var cms = new ContentMatchSet(needles, StreamVersionMock, "name");
|
||||
@@ -54,7 +54,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
#region Array
|
||||
|
||||
[Fact]
|
||||
public void MatchesAllNullArrayReturnsNoMatches()
|
||||
public void MatchesAll_NullArray_NoMatches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
var actual = cms.MatchesAll((byte[]?)null);
|
||||
@@ -62,7 +62,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAllEmptyArrayReturnsNoMatches()
|
||||
public void MatchesAll_EmptyArray_NoMatches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
var actual = cms.MatchesAll([]);
|
||||
@@ -70,7 +70,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAllMatchingArrayReturnsMatches()
|
||||
public void MatchesAll_MatchingArray_Matches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
var actual = cms.MatchesAll([0x01, 0x02, 0x03, 0x04]);
|
||||
@@ -79,7 +79,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAllMismatchedArrayReturnsNoMatches()
|
||||
public void MatchesAll_MismatchedArray_NoMatches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
var actual = cms.MatchesAll([0x01, 0x03]);
|
||||
@@ -87,7 +87,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAnyNullArrayReturnsNoMatches()
|
||||
public void MatchesAny_NullArray_NoMatches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
int actual = cms.MatchesAny((byte[]?)null);
|
||||
@@ -95,7 +95,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAnyEmptyArrayReturnsNoMatches()
|
||||
public void MatchesAny_EmptyArray_NoMatches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
int actual = cms.MatchesAny([]);
|
||||
@@ -103,7 +103,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAnyMatchingArrayReturnsMatches()
|
||||
public void MatchesAny_MatchingArray_Matches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
int actual = cms.MatchesAny([0x01, 0x02, 0x03, 0x04]);
|
||||
@@ -111,7 +111,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAnyMismatchedArrayReturnsNoMatches()
|
||||
public void MatchesAny_MismatchedArray_NoMatches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
int actual = cms.MatchesAny([0x01, 0x03]);
|
||||
@@ -123,7 +123,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
#region Stream
|
||||
|
||||
[Fact]
|
||||
public void MatchesAllNullStreamReturnsNoMatches()
|
||||
public void MatchesAll_NullStream_NoMatches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
var actual = cms.MatchesAll((Stream?)null);
|
||||
@@ -131,7 +131,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAllEmptyStreamReturnsNoMatches()
|
||||
public void MatchesAll_EmptyStream_NoMatches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
var actual = cms.MatchesAll(new MemoryStream());
|
||||
@@ -139,7 +139,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAllMatchingStreamReturnsMatches()
|
||||
public void MatchesAll_MatchingStream_Matches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
var actual = cms.MatchesAll(new MemoryStream([0x01, 0x02, 0x03, 0x04]));
|
||||
@@ -148,7 +148,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAllMismatchedStreamReturnsNoMatches()
|
||||
public void MatchesAll_MismatchedStream_NoMatches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
var actual = cms.MatchesAll([0x01, 0x03]);
|
||||
@@ -156,7 +156,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAnyNullStreamReturnsNoMatches()
|
||||
public void MatchesAny_NullStream_NoMatches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
int actual = cms.MatchesAny((Stream?)null);
|
||||
@@ -164,7 +164,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAnyEmptyStreamReturnsNoMatches()
|
||||
public void MatchesAny_EmptyStream_NoMatches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
int actual = cms.MatchesAny(new MemoryStream());
|
||||
@@ -172,7 +172,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAnyMatchingStreamReturnsMatches()
|
||||
public void MatchesAny_MatchingStream_Matches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
int actual = cms.MatchesAny(new MemoryStream([0x01, 0x02, 0x03, 0x04]));
|
||||
@@ -180,7 +180,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchesAnyMismatchedStreamReturnsNoMatches()
|
||||
public void MatchesAny_MismatchedStream_NoMatches()
|
||||
{
|
||||
var cms = new ContentMatchSet(new byte[] { 0x01, 0x02, 0x03, 0x04 }, "name");
|
||||
int actual = cms.MatchesAny([0x01, 0x03]);
|
||||
|
||||
@@ -8,28 +8,28 @@ namespace SabreTools.Matching.Test.Content
|
||||
public class ContentMatchTests
|
||||
{
|
||||
[Fact]
|
||||
public void InvalidNeedleThrowsException()
|
||||
public void InvalidNeedle_ThrowsException()
|
||||
{
|
||||
Assert.Throws<InvalidDataException>(() => new ContentMatch(Array.Empty<byte>()));
|
||||
Assert.Throws<InvalidDataException>(() => new ContentMatch(Array.Empty<byte?>()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InvalidStartThrowsException()
|
||||
public void InvalidStart_ThrowsException()
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new ContentMatch(new byte[1], start: -1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new ContentMatch(new byte?[1], start: -1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InvalidEndThrowsException()
|
||||
public void InvalidEnd_ThrowsException()
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new ContentMatch(new byte[1], end: -2));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new ContentMatch(new byte?[1], end: -2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ImplicitOperatorArrayReturnsSuccess()
|
||||
public void ImplicitOperatorArray_Success()
|
||||
{
|
||||
byte[] needle = [0x01, 0x02, 0x03, 0x04];
|
||||
var cm = (ContentMatch)needle;
|
||||
@@ -37,7 +37,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ImplicitOperatorNullableArrayReturnsSuccess()
|
||||
public void ImplicitOperatorNullableArray_Success()
|
||||
{
|
||||
byte?[] needle = [0x01, 0x02, 0x03, 0x04];
|
||||
var cm = (ContentMatch)needle;
|
||||
@@ -47,7 +47,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
#region Byte Array
|
||||
|
||||
[Fact]
|
||||
public void NullArrayReturnsNoMatch()
|
||||
public void NullArray_NoMatch()
|
||||
{
|
||||
var cm = new ContentMatch(new byte?[1]);
|
||||
int actual = cm.Match((byte[]?)null);
|
||||
@@ -55,7 +55,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EmptyArrayReturnsNoMatch()
|
||||
public void EmptyArray_NoMatch()
|
||||
{
|
||||
var cm = new ContentMatch(new byte?[1]);
|
||||
int actual = cm.Match([]);
|
||||
@@ -63,7 +63,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LargerNeedleArrayReturnsNoMatch()
|
||||
public void LargerNeedleArray_NoMatch()
|
||||
{
|
||||
var cm = new ContentMatch(new byte?[2]);
|
||||
int actual = cm.Match(new byte[1]);
|
||||
@@ -71,7 +71,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EqualLengthMatchingArrayReturnsMatch()
|
||||
public void EqualLengthMatchingArray_Match()
|
||||
{
|
||||
byte[] needle = [0x01, 0x02, 0x03, 0x04];
|
||||
var cm = new ContentMatch(needle);
|
||||
@@ -81,7 +81,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EqualLengthMatchingArrayReverseReturnsMatch()
|
||||
public void EqualLengthMatchingArrayReverse_Match()
|
||||
{
|
||||
byte[] needle = [0x01, 0x02, 0x03, 0x04];
|
||||
var cm = new ContentMatch(needle);
|
||||
@@ -91,7 +91,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EqualLengthMismatchedArrayReturnsNoMatch()
|
||||
public void EqualLengthMismatchedArray_NoMatch()
|
||||
{
|
||||
byte[] needle = [0x01, 0x02, 0x03, 0x04];
|
||||
var cm = new ContentMatch(needle);
|
||||
@@ -101,7 +101,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EqualLengthMismatchedArrayReverseReturnsNoMatch()
|
||||
public void EqualLengthMismatchedArrayReverse_NoMatch()
|
||||
{
|
||||
byte[] needle = [0x01, 0x02, 0x03, 0x04];
|
||||
var cm = new ContentMatch(needle);
|
||||
@@ -111,7 +111,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InequalLengthMatchingArrayReturnsMatch()
|
||||
public void InequalLengthMatchingArray_Match()
|
||||
{
|
||||
byte[] stack = [0x01, 0x02, 0x03, 0x04];
|
||||
byte[] needle = [0x02, 0x03];
|
||||
@@ -122,7 +122,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InequalLengthMatchingArrayReverseReturnsMatch()
|
||||
public void InequalLengthMatchingArrayReverse_Match()
|
||||
{
|
||||
byte[] stack = [0x01, 0x02, 0x03, 0x04];
|
||||
byte[] needle = [0x02, 0x03];
|
||||
@@ -133,7 +133,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InequalLengthMismatchedArrayReturnsNoMatch()
|
||||
public void InequalLengthMismatchedArray_NoMatch()
|
||||
{
|
||||
byte[] stack = [0x01, 0x02, 0x03, 0x04];
|
||||
byte[] needle = [0x02, 0x04];
|
||||
@@ -144,7 +144,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InequalLengthMismatchedArrayReverseReturnsNoMatch()
|
||||
public void InequalLengthMismatchedArrayReverse_NoMatch()
|
||||
{
|
||||
byte[] stack = [0x01, 0x02, 0x03, 0x04];
|
||||
byte[] needle = [0x02, 0x04];
|
||||
@@ -159,7 +159,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
#region Stream
|
||||
|
||||
[Fact]
|
||||
public void NullStreamReturnsNoMatch()
|
||||
public void NullStream_NoMatch()
|
||||
{
|
||||
var cm = new ContentMatch(new byte?[1]);
|
||||
int actual = cm.Match((Stream?)null);
|
||||
@@ -167,7 +167,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EmptyStreamReturnsNoMatch()
|
||||
public void EmptyStream_NoMatch()
|
||||
{
|
||||
var cm = new ContentMatch(new byte?[1]);
|
||||
int actual = cm.Match(new MemoryStream());
|
||||
@@ -175,7 +175,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LargerNeedleStreamReturnsNoMatch()
|
||||
public void LargerNeedleStream_NoMatch()
|
||||
{
|
||||
var cm = new ContentMatch(new byte?[2]);
|
||||
int actual = cm.Match(new MemoryStream(new byte[1]));
|
||||
@@ -183,7 +183,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EqualLengthMatchingStreamReturnsMatch()
|
||||
public void EqualLengthMatchingStream_Match()
|
||||
{
|
||||
byte[] needle = [0x01, 0x02, 0x03, 0x04];
|
||||
var cm = new ContentMatch(needle);
|
||||
@@ -193,7 +193,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EqualLengthMatchingStreamReverseReturnsMatch()
|
||||
public void EqualLengthMatchingStreamReverse_Match()
|
||||
{
|
||||
byte[] needle = [0x01, 0x02, 0x03, 0x04];
|
||||
var cm = new ContentMatch(needle);
|
||||
@@ -203,7 +203,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EqualLengthMismatchedStreamReturnsNoMatch()
|
||||
public void EqualLengthMismatchedStream_NoMatch()
|
||||
{
|
||||
byte[] needle = [0x01, 0x02, 0x03, 0x04];
|
||||
var cm = new ContentMatch(needle);
|
||||
@@ -213,7 +213,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EqualLengthMismatchedStreamReverseReturnsNoMatch()
|
||||
public void EqualLengthMismatchedStreamReverse_NoMatch()
|
||||
{
|
||||
byte[] needle = [0x01, 0x02, 0x03, 0x04];
|
||||
var cm = new ContentMatch(needle);
|
||||
@@ -223,7 +223,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InequalLengthMatchingStreamReturnsMatch()
|
||||
public void InequalLengthMatchingStream_Match()
|
||||
{
|
||||
Stream stack = new MemoryStream([0x01, 0x02, 0x03, 0x04]);
|
||||
byte[] needle = [0x02, 0x03];
|
||||
@@ -234,7 +234,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InequalLengthMatchingStreamReverseReturnsMatch()
|
||||
public void InequalLengthMatchingStreamReverse_Match()
|
||||
{
|
||||
Stream stack = new MemoryStream([0x01, 0x02, 0x03, 0x04]);
|
||||
byte[] needle = [0x02, 0x03];
|
||||
@@ -245,7 +245,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InequalLengthMismatchedStreamReturnsNoMatch()
|
||||
public void InequalLengthMismatchedStream_NoMatch()
|
||||
{
|
||||
Stream stack = new MemoryStream([0x01, 0x02, 0x03, 0x04]);
|
||||
byte[] needle = [0x02, 0x04];
|
||||
@@ -256,7 +256,7 @@ namespace SabreTools.Matching.Test.Content
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InequalLengthMismatchedStreamReverseReturnsNoMatch()
|
||||
public void InequalLengthMismatchedStreamReverse_NoMatch()
|
||||
{
|
||||
Stream stack = new MemoryStream([0x01, 0x02, 0x03, 0x04]);
|
||||
byte[] needle = [0x02, 0x04];
|
||||
|
||||
Reference in New Issue
Block a user