public void Execute_NullMemory_Succeeds() { IntPtr pointer = new IntPtr(0xbeef); IntPtr expected = pointer + 50; var op = new AddOperator(pointer, 50); IntPtr actual = op.Execute(null); Assert.AreEqual(expected, actual); }
public void Execute_SomePointer_Succeeds() { var memMock = new Mock<IMemory>(); IntPtr pointer = new IntPtr(0xbeef); IntPtr expected = pointer + 50; var op = new AddOperator(pointer, 50); IntPtr actual = op.Execute(memMock.Object); Assert.AreEqual(expected, actual); }
public void StringConstructor_ValidString_InitializesToParsedValue() { var op = new AddOperator(() => "C0", () => IntPtr.Zero.ToString("X")); Assert.AreEqual(0xC0, op.Offset); }
public void StringConstructor_NullString_InitializesToDefault() { var op = new AddOperator(() => null, () => IntPtr.Zero.ToString("X")); Assert.AreEqual(0, op.Offset); }
public void StringConstructor_InvalidString_ThrowsWhenEvaluated() { int offset = new AddOperator(() => "invalid value", () => IntPtr.Zero.ToString("X")).Offset; }
public void IsCacheable_Get_ReturnsTrue() { var op = new AddOperator(); Assert.IsTrue(op.IsCacheable); }
public void IntegerConstructor_Called_InitializesOffsetToValue() { var op = new AddOperator(IntPtr.Zero, 50); Assert.AreEqual(50, op.Offset); }
public void DefaultConstructor_Called_InitializesOffsetToZero() { var op = new AddOperator(); Assert.AreEqual(0, op.Offset); }