public void TestCropNullRectangle() { GameMapBlock<long> testBlock = new GameMapBlock<long>(new Vector2(0, 0)); testBlock.AddContentElement(-1); long[] expectedResult = new long[] { -1 }; long[] testCrop = (testBlock.Crop(new Rectangle(0, 0, 0, 0)) as List<long>).ToArray(); CollectionAssert.AreEqual(expectedResult, testCrop); }
public void TestCropBase() { GameMapBlock<long> testBlock = new GameMapBlock<long>(new Vector2(2,2)); for (int i = 0; i < 4; i++) testBlock.AddContentElement(-1); object croppedResults = testBlock.Crop(new Rectangle(0,0,2,2)); CollectionAssert.AreEqual((ICollection)testBlock.Contents, (croppedResults as List<long>)); }
public void TestCropNegativeRectangle() { GameMapBlock<long> testBlock = new GameMapBlock<long>(new Vector2(2, 2)); for (int i = 0; i < testBlock.Dimensions.X * testBlock.Dimensions.Y; i++) testBlock.AddContentElement(-1); List<long> croppedContents = (List<long>)testBlock.Crop(new Rectangle(0, 0, -2, -2)); long[] expectedResult = new long[] { -1, -1, -1, -1 }; CollectionAssert.AreEqual(expectedResult, croppedContents.ToArray()); }