using System; using System.Collections.Generic; using System.Text; using UnitTestSharp; using Sunweaver.DataPrototypes; namespace Sunweaver.UnitTests { public class MemoryTest : TestFixture { Int16 testvalue = 599; Int16 testlocation = 10; Memory mem; public MemoryTest() { mem = new Memory(); } public void MemoryRoundTripsSuccessfully() { mem[testlocation] = testvalue; CheckTrue( mem[testlocation] == testvalue); } public void ThrowsExceptionOutOfBounds_Write() { CheckThrow(typeof(Exception)); mem[2000] = 10; } public void ThrowsExceptionOutOfBounds_Read() { CheckThrow(typeof(Exception)); int a = mem[2000]; } public void NegativeIndexes_Read() { mem[testlocation] = testvalue; CheckEqual(testvalue, mem[-testlocation]); } public void NegativeIndexes_Write() { mem[-testlocation] = testvalue; CheckEqual(testvalue, mem[testlocation]); } } }