Exemplo n.º 1
0
        public void TestCompare(ScanCompareType compareType, byte value1, byte value2, byte[] data, bool expectedResult, ScanResult expectedScanResult)
        {
            var sut = new ByteMemoryComparer(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 <ByteScanResult>();
            }
        }
Exemplo n.º 2
0
        public void TestCompareInvalidCompareTypeThrows(ScanCompareType compareType)
        {
            var sut = new ByteMemoryComparer(compareType, 0, 0);

            Check.ThatCode(() => sut.Compare(new byte[] { 0 }, 0, out _)).Throws <InvalidCompareTypeException>();
        }
Exemplo n.º 3
0
        public void TestCompareWithPreviousThrows()
        {
            var sut = new ByteMemoryComparer(ScanCompareType.Unknown, 0, 0);

            Check.ThatCode(() => sut.Compare(new byte[] { 0 }, 0, new ByteScanResult(0), out _)).Throws <InvalidCompareTypeException>();
        }
Exemplo n.º 4
0
        public void TestCompareInvalidDataThrows(byte[] data, int index, Type expectedExceptionType)
        {
            var sut = new ByteMemoryComparer(ScanCompareType.Equal, 0, 0);

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