public void ReadRotationInvalidSize() { // Well formed stream data byte[] streamData = { 1, 0, 0, 0, 232, 3, 0, 0, 200, 0, 0, 0, 200, 0, 0, 0, 145, 0, 0, 0, 145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; for (int dataSize = 0; dataSize < streamData.Length - 1; dataSize++) { WangStream stream = new WangStream(streamData); WangRotation read = WangAnnotationStructureReader.ReadRotation(stream, dataSize); Assert.IsTrue(read == null); } }
public void ReadRotationStdExactDifferentResolution() { byte[] streamData = { 1, 0, 0, 0, 232, 3, 0, 0, 200, 0, 0, 0, 200, 0, 0, 0, 200, 0, 0, 0, 145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; WangStream stream = new WangStream(streamData); WangRotation read = WangAnnotationStructureReader.ReadRotation(stream, 56); Assert.IsTrue(read != null); Assert.AreEqual(200, read.OrigHRes); Assert.AreEqual(145, read.OrigVRes); Assert.AreEqual(1, read.Rotation); Assert.AreEqual(0, stream.AvailableBytes()); }