public PatchRequest2Legacy ComposeReferencePatch( string referenceAttributeName, string referencedObjectUniqueIdentifier, OperationName operationName) { Assert.IsFalse(string.IsNullOrWhiteSpace(referenceAttributeName)); Assert.IsFalse(string.IsNullOrWhiteSpace(referencedObjectUniqueIdentifier)); IPath path; Assert.IsTrue(Path.TryParse(referenceAttributeName, out path)); OperationValue operationValue = new OperationValue() { Value = referencedObjectUniqueIdentifier }; PatchOperation2 operation = new PatchOperation2() { Name = operationName, Path = path }; operation.AddValue(operationValue); PatchRequest2Legacy result = new PatchRequest2Legacy(); result.AddOperation(operation); return(result); }
public PatchRequest2Legacy ComposeUserPatch() { string value = Guid.NewGuid().ToString(SampleComposer.FormatUniqueIdentifierCompressed); IPath path; PatchOperation2 operation; OperationValue operationValue; PatchRequest2Legacy result = new PatchRequest2Legacy(); Assert.IsTrue(Path.TryParse(AttributeNames.Active, out path)); operationValue = new OperationValue() { Value = bool.FalseString }; operation = new PatchOperation2() { Name = OperationName.Replace, Path = path }; operation.AddValue(operationValue); result.AddOperation(operation); Assert.IsTrue(Path.TryParse(AttributeNames.DisplayName, out path)); operationValue = new OperationValue() { Value = value }; operation = new PatchOperation2() { Name = OperationName.Replace, Path = path }; operation.AddValue(operationValue); result.AddOperation(operation); Assert.IsTrue(Path.TryParse(SampleComposer.PathExpressionPrimaryWorkElectronicMailAddress, out path)); string electronicMailAddressValue = string.Format( CultureInfo.InvariantCulture, SampleComposer.ElectronicMailAddressTemplate, value); operationValue = new OperationValue() { Value = electronicMailAddressValue }; operation = new PatchOperation2() { Name = OperationName.Replace, Path = path }; operation.AddValue(operationValue); result.AddOperation(operation); Assert.IsTrue(Path.TryParse(SampleComposer.PathExpressionPostalCode, out path)); operationValue = new OperationValue() { Value = value }; operation = new PatchOperation2() { Name = OperationName.Replace, Path = path }; operation.AddValue(operationValue); result.AddOperation(operation); return(result); }