private void TestSerializeDefaultableGeneric <T>(T testValue) { Defaultable <T> value = new Defaultable <T>(); TestDefaultableAsDefault(value); value.SetAsCustom(testValue); Defaultable <T> cloned = value.CloneBySerialization(); Assert.IsTrue(value.EqualsTo(cloned), string.Format("Serializing '{0}' value", testValue.GetType().Name)); }
private void TestDefaultableMerge <T>(T currentValue, T otherValue, MergeConflictAction mergeConflictAction) { Defaultable <T> current = new Defaultable <T>(); current.SetAsCustom(currentValue); Defaultable <T> other = new Defaultable <T>(); other.SetAsCustom(otherValue); Defaultable <T> merged = current.Merge(other, mergeConflictAction); string errorMessage = string.Format("Merging '{0}' values", currentValue.GetType().Name); if (mergeConflictAction == MergeConflictAction.TakeCurrent) { Assert.IsTrue(current.EqualsTo(merged), errorMessage); } else if (mergeConflictAction == MergeConflictAction.TakeOther) { Assert.IsTrue(other.EqualsTo(merged), errorMessage); } }
private void TestDefaultableAsDefault(Defaultable source) { Defaultable cloned = source.CloneBySerialization(); Assert.IsTrue(source.EqualsTo(cloned)); }