Esempio n. 1
0
 public OperationsMockery SetNextObject(IZMachineObject value)
 {
     _objectsMock
     .Setup(m => m.GetOrDefault(It.IsAny <ushort>()))
     .Returns(value);
     return(this);
 }
Esempio n. 2
0
 public OperationsMockery SetGetObject(ushort objNumber, IZMachineObject value)
 {
     _objectsMock
     .Setup(m => m.GetOrDefault(It.Is <ushort>(o => objNumber == o)))
     .Returns(value);
     return(this);
 }
Esempio n. 3
0
        public bool TryGetValue(ushort key, out IZMachineObject value)
        {
            var found = _dict.TryGetValue(key, out value);

            if (found)
            {
                value.RefreshFromMemory();
            }
            return(found);
        }
Esempio n. 4
0
        private void RemoveObjectFromParent(IZMachineObject zObj, IZMachineObject firstChild)
        {
            var currentZObjToSet = firstChild;
            var nextSibling      = Memory.ObjectTree.GetOrDefault(firstChild.Sibling);

            // while sibling of parent1's child has siblings
            while (nextSibling.ObjectNumber != 0)
            {
                // if obj1 is the sibling of the current object
                if (nextSibling.ObjectNumber == zObj.ObjectNumber)
                {
                    // set the current object's sibling to the next sibling
                    currentZObjToSet.Sibling = zObj.Sibling;
                    break;
                }

                currentZObjToSet = nextSibling;
                nextSibling      = Memory.ObjectTree.GetOrDefault(nextSibling.Sibling);
            }
        }