public byte[] Should_the_origin_memory_contain_the_correct_data_when_using_the_INDEXER_method(int startOffset, int value) { using (var managedMemory = new ManagedMemory(10)) { using (var subset = new MemorySubset(managedMemory, 2, 4, false)) { subset[startOffset] = (byte)value; return(managedMemory.ToArray()); } } }
public void Should_the_origin_memory_contain_the_correct_data() { var expected = new byte[] { 0x0, 0x0, 0x1, 0x2, 0x3, 0x4, 0x0, 0x0, 0x0, 0x0 }; var memo = managedMemory.ToArray(); for (var i = 0; i < expected.Length; i++) { Assert.AreEqual(expected[i], memo[i]); } }
public void Should_the_origin_memory_contain_the_correct_data_when_using_the_INDEXER_method(int startOffset, int value, byte[] expectedResult) { using (var managedMemory = new ManagedMemory(10)) { using (var subset = new MemorySubset(managedMemory, 2, 4, false)) { if (expectedResult == null) { Assert.Throws <ArgumentOutOfRangeException>(delegate { var result = subset[startOffset] = (byte)value; }); } else { subset[startOffset] = (byte)value; var memo = managedMemory.ToArray(); for (var i = 0; i < expectedResult.Length; i++) { Assert.AreEqual(expectedResult[i], memo[i]); } } } } }
public void Should_the_origin_memory_contain_the_correct_data() { managedMemory.ToArray().Should().ContainInOrder(new byte[] { 0x0, 0x0, 0x1, 0x2, 0x3, 0x4, 0x0, 0x0, 0x0, 0x0 }); }
public byte[] Should_the_origin_memory_contain_the_correct_data_when_using_the_INDEXER_method(int startOffset, int value) { using (var managedMemory = new ManagedMemory(10)) { using (var subset = new MemorySubset(managedMemory, 2, 4, false)) { subset[startOffset] = (byte) value; return managedMemory.ToArray(); } } }