public void TestCreate() { var patch = _featureDiffPatch.Diff(null, _v1).Serialize(); var patched = _featureDiffPatch.Patch(null, FeatureDiff.Deserialize(patch)); CheckEqual(_v1, patched); }
public void TestModify() { var patch = _featureDiffPatch.Diff(_v1, _v2).Serialize(); var patched = _featureDiffPatch.Patch(_v1, FeatureDiff.Deserialize(patch)); CheckEqual(_v2, patched); }
public void TestDelete() { var patch = _featureDiffPatch.Diff(_v1, null).Serialize(); var patched = _featureDiffPatch.Patch(_v1, FeatureDiff.Deserialize(patch)); Assert.IsNull(patched.Geometry); Assert.IsNull(patched.Attributes); }
public Feature <TGeometry, TAttributes> Patch(Feature <TGeometry, TAttributes> v1, FeatureDiff diff) => diff == default ? default : new Feature <TGeometry, TAttributes>() { Attributes = PatchAttributes(GetAttributes(v1), diff.AttributeDiff), Geometry = PatchGeometry(GetGeometry(v1), diff.GeometryDiff) };