Example #1
0
        public void StringConstructor_NullString_InitializesLeaTypeToDword()
        {
            var op = new LeaOperator(() => null, () => null);

            Assert.AreEqual(LeaType.Dword, op.Type);
        }
Example #2
0
        public void StringConstructor_ValidString_InitializesLeaTypeToValue()
        {
            var op = new LeaOperator(() => "Word", () => null);

            Assert.AreEqual(LeaType.Word, op.Type);
        }
Example #3
0
        public void LeaTypeConstructor_Called_InitializesLeaTypeToValue()
        {
            var op = new LeaOperator(IntPtr.Zero, LeaType.Pointer);

            Assert.AreEqual(LeaType.Pointer, op.Type);
        }
Example #4
0
 public void StringConstructor_InvalidString_ThrowsWhenEvaluated()
 {
     LeaType type = new LeaOperator(() => "invalid value", () => null).Type;
 }
Example #5
0
        public void IsCacheable_Get_ReturnsFalse()
        {
            var op = new LeaOperator();

            Assert.IsFalse(op.IsCacheable);
        }
Example #6
0
        public void Execute_UnknownLeaType_Throws()
        {
            IntPtr pointer = new IntPtr(0xbeef);
            var op = new LeaOperator(pointer, (LeaType)15);

            op.Execute(null);
        }
Example #7
0
        public void Execute_SomePointer_Succeeds()
        {
            var memMock = new Mock<IMemory>();
            IntPtr pointer = new IntPtr(0xbeef);
            ushort expected = 0xdead;
            var op = new LeaOperator(pointer, LeaType.Word);

            memMock.Setup(x => x.Read<ushort>(pointer)).Returns(expected);

            IntPtr actual = op.Execute(memMock.Object);

            Assert.AreEqual(expected, (ushort)actual);
        }
Example #8
0
        public void Execute_NullMemory_Throws()
        {
            IntPtr pointer = new IntPtr(0xbeef);
            var op = new LeaOperator(pointer);

            op.Execute(null);
        }
Example #9
0
        public void DefaultConstructor_Called_InitializesLeaTypeToDword()
        {
            var op = new LeaOperator();

            Assert.AreEqual(LeaType.Dword, op.Type);
        }