Пример #1
0
    public static void ApplyVector3()
    {
        var previous = Vector3.zero;
        var current  = Vector3.one;

        var delta = SavedObjectDelta.FromObjects(current, previous);

        delta.ApplyChanges(ref previous);

        Assert.AreEqual(current, previous);
    }
Пример #2
0
    public static void ChangeInstanceTypeToNull()
    {
        var before = new HostObject()
        {
            nested = new DerivedObject()
        };
        var after = new HostObject();

        var delta = SavedObjectDelta.FromObjects(after, before);

        delta.ApplyChanges(ref before);

        Assert.AreEqual(after.nested, before.nested);
    }
Пример #3
0
    public static void ApplyNestedStruct()
    {
        var current = new StructA {
            a = 2, structB = new StructB {
                b = 3
            }
        };
        var previous = new StructA {
            a = 1, structB = new StructB {
                b = 1
            }
        };

        var delta = SavedObjectDelta.FromObjects(current, previous);

        delta.ApplyChanges(ref previous);

        Assert.AreEqual(current, previous);
    }