public static void MultyblockRange() { //Simple test var multyblockRange = new MultyblockRange(0, 3, new[] { new BlockRange(BlockSize / 2, BlockSize / 2, 0), new BlockRange(0, BlockSize, BlockSize), new BlockRange(0, BlockSize / 2, 2 * BlockSize) }); Assert.IsTrue( TestStructure.MultyblockRange(new Range(BlockSize / 2, 2 * BlockSize)) .Equals(multyblockRange)); //Exceptions //Left overlap Assert.IsTrue( ExceptionManager.IsThrowFuncException <ArgumentOutOfRangeException, Range, MultyblockRange> (TestStructure.MultyblockRange, new Range(-1, 2))); //Rigth overlap Assert.IsTrue( ExceptionManager.IsThrowFuncException <ArgumentOutOfRangeException, Range, MultyblockRange> (TestStructure.MultyblockRange, new Range(CountOfBlocks * BlockSize - 1, 2))); //Wrong count Assert.IsTrue( ExceptionManager.IsThrowFuncException <ArgumentOutOfRangeException, Range, MultyblockRange> (TestStructure.MultyblockRange, new Range(BlockSize, -2))); }
public static void ReverseMultyblockRange() { //Simple test var reverseMultyblockRange = new MultyblockRange(2, 3, new[] { new BlockRange(BlockSize*5/2, BlockSize/2, 2*BlockSize), new BlockRange(2*BlockSize - 1, BlockSize, BlockSize), new BlockRange(BlockSize -1, BlockSize, 0) }); Assert.IsTrue( TestStructure.ReverseMultyblockRange(new Range(BlockSize * 5 / 2, BlockSize * 5 / 2 + 1)) .Equals(reverseMultyblockRange)); //Exceptions //Left overlap Assert.IsTrue( ExceptionManager.IsThrowFuncException<ArgumentOutOfRangeException, Range, MultyblockRange> (TestStructure.ReverseMultyblockRange, new Range(0, 2))); //Rigth overlap Assert.IsTrue( ExceptionManager.IsThrowFuncException<ArgumentOutOfRangeException, Range, MultyblockRange> (TestStructure.ReverseMultyblockRange, new Range(CountOfBlocks * BlockSize, 2))); //Wrong count Assert.IsTrue( ExceptionManager.IsThrowFuncException<ArgumentOutOfRangeException, Range, MultyblockRange> (TestStructure.ReverseMultyblockRange, new Range(BlockSize, -2))); }