public static void TestWriteCacheNode_AssetId_CorrectZeros() { var buffer = new byte[WriteCacheNode.BYTE_SIZE]; var node = new WriteCacheNode(buffer, 0); Assert.AreEqual(Guid.Empty, node.AssetId); }
public static void TestWriteCacheNode_FileOffset_Correct() { var buffer = new byte[WriteCacheNode.BYTE_SIZE]; var offset = ulong.MaxValue; var node = new WriteCacheNode(buffer, offset); Assert.AreEqual(offset, node.FileOffset); }
public static void TestWriteCacheNode_IsAvailable255_False() { var buffer = new byte[WriteCacheNode.BYTE_SIZE]; buffer[0] = 255; var node = new WriteCacheNode(buffer, 0); Assert.False(node.IsAvailable); }
public static void TestWriteCacheNode_AssetId_CorrectRandom() { var buffer = new byte[WriteCacheNode.BYTE_SIZE]; var guid = Guid.NewGuid(); Buffer.BlockCopy(guid.ToByteArray(), 0, buffer, 1, 16); var node = new WriteCacheNode(buffer, 0); Assert.AreEqual(guid, node.AssetId); }
public static void TestWriteCacheNode_ToByteArray_CorrectRandom() { var buffer = new byte[WriteCacheNode.BYTE_SIZE]; var guid = Guid.NewGuid(); var offset = RandomUtil.NextULong(); buffer[0] = RandomUtil.NextBool() ? (byte)0 : (byte)1; Buffer.BlockCopy(guid.ToByteArray(), 0, buffer, 1, 16); var node = new WriteCacheNode(buffer, offset); Assert.AreEqual(buffer, node.ToByteArray()); }