public void TestSyncDeltaType() { SyncDeltaType v1 = SyncDeltaType.DELETE; SyncDeltaType v2 = (SyncDeltaType)CloneObject(v1); Assert.AreEqual(v1, v2); }
/// <summary> /// Creates a new <code>SyncDeltaBuilder</code> whose /// values are initialized to those of the delta. /// </summary> /// <param name="delta">The original delta.</param> public SyncDeltaBuilder(SyncDelta delta) { _token = delta.Token; _deltaType = delta.DeltaType; _previousUid = delta.PreviousUid; _uid = delta.Uid; _object = delta.Object; }
/// <summary> /// Creates a SyncDelata /// </summary> /// <param name="token">The token. Must not be null.</param> /// <param name="deltaType">The delta. Must not be null.</param> /// <param name="uid">The uid. Must not be null.</param> /// <param name="object">The object that has changed. May be null for delete.</param> internal SyncDelta(SyncToken token, SyncDeltaType deltaType, Uid previousUid, Uid uid, ConnectorObject obj) { Assertions.NullCheck(token, "token"); Assertions.NullCheck(deltaType, "deltaType"); Assertions.NullCheck(uid, "uid"); //do not allow previous Uid for anything else than create or update if (previousUid != null && deltaType != SyncDeltaType.CREATE_OR_UPDATE) { throw new ArgumentException("The previous Uid can only be specified for create or update."); } //only allow null object for delete if (obj == null && deltaType != SyncDeltaType.DELETE) { throw new ArgumentException("ConnectorObject must be specified for anything other than delete."); } //if object not null, make sure its Uid //matches if (obj != null) { if (!uid.Equals(obj.Uid)) { throw new ArgumentException("Uid does not match that of the object."); } } _token = token; _deltaType = deltaType; _previousUid = previousUid; _uid = uid; _object = obj; }