Beispiel #1
0
        public void TestCompare(ScanCompareType compareType, int value1, int value2, byte[] data, bool expectedResult, ScanResult expectedScanResult)
        {
            var sut = new IntegerMemoryComparer(compareType, value1, value2);

            Check.That(sut.Compare(data, 0, out var scanResult)).IsEqualTo(expectedResult);
            Check.That(scanResult).IsEqualTo(expectedScanResult);
            if (scanResult != null)
            {
                Check.That(scanResult).IsInstanceOf <IntegerScanResult>();
            }
        }
Beispiel #2
0
        public void TestCompareInvalidCompareTypeThrows(ScanCompareType compareType)
        {
            var sut = new IntegerMemoryComparer(compareType, 0, 0);

            Check.ThatCode(() => sut.Compare(BitConverter.GetBytes(0), 0, out _)).Throws <InvalidCompareTypeException>();
        }
Beispiel #3
0
        public void TestCompareWithPreviousThrows()
        {
            var sut = new IntegerMemoryComparer(ScanCompareType.Unknown, 0, 0);

            Check.ThatCode(() => sut.Compare(BitConverter.GetBytes(0), 0, new IntegerScanResult(0), out _)).Throws <InvalidCompareTypeException>();
        }
Beispiel #4
0
        public void TestCompareInvalidDataThrows(byte[] data, int index, Type expectedExceptionType)
        {
            var sut = new IntegerMemoryComparer(ScanCompareType.Equal, 0, 0);

            Check.ThatCode(() => sut.Compare(data, index, out _)).ThrowsType(expectedExceptionType);
        }