private static IReadOnlyDictionary <string, string> Apply(PatchRequest2 patch, string schemaIdentifier, IRow row) { if (null == patch) { throw new ArgumentNullException(nameof(patch)); } if (string.IsNullOrWhiteSpace(schemaIdentifier)) { throw new ArgumentNullException(nameof(schemaIdentifier)); } IReadOnlyDictionary <string, string> result; switch (schemaIdentifier) { case SchemaIdentifiers.Core2EnterpriseUser: result = FileProvider.PatchUser(patch, row); return(result); case DynamicConstants.SchemaIdentifierUser: result = FileProvider.PatchDynamicUser(patch, row); return(result); case SchemaIdentifiers.WindowsAzureActiveDirectoryGroup: result = FileProvider.PatchGroup(patch, row); return(result); default: throw new NotSupportedException(schemaIdentifier); } }
public async Task TestUpdateUser() { Func <ProviderBase, Task> testFunction = new Func <ProviderBase, Task>( async(ProviderBase provider) => { PatchRequest2 patchRequest = SampleComposer.Instance.ComposeUserPatch(); string correlationIdentifierCreate = Guid.NewGuid().ToString(); Resource inputResource = SampleComposer.Instance.ComposeUserResource(); Resource outputResource = await provider.CreateAsync(inputResource, correlationIdentifierCreate); Assert.IsNotNull(outputResource); Assert.IsFalse(string.IsNullOrWhiteSpace(outputResource.Identifier)); IResourceIdentifier resourceIdentifier = new ResourceIdentifier() { SchemaIdentifier = SchemaIdentifiers.Core2EnterpriseUser, Identifier = outputResource.Identifier }; IPatch patch = new Patch() { ResourceIdentifier = resourceIdentifier, PatchRequest = patchRequest }; string correlationIdentifierUpdate = Guid.NewGuid().ToString(); await provider.UpdateAsync(patch, correlationIdentifierUpdate); }); await this.RunTest(testFunction); }
public PatchRequest2 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 }; PatchOperation operation = new PatchOperation() { Name = operationName, Path = path }; operation.AddValue(operationValue); PatchRequest2 result = new PatchRequest2(); result.AddOperation(operation); return(result); }
private static IReadOnlyDictionary <string, string> PatchUser(PatchRequest2 patch, IRow row) { ResourceFactory <Core2EnterpriseUser> userFactory = new UserFactory(row); Core2EnterpriseUser user = userFactory.Create(); user.Apply(patch); ColumnsFactory <Core2EnterpriseUser> userColumnsFactory = new UserColumnsFactory(user); IReadOnlyDictionary <string, string> result = userColumnsFactory.CreateColumns(); return(result); }
private static IReadOnlyDictionary <string, string> PatchGroup(PatchRequest2 patch, IRow row) { ResourceFactory <WindowsAzureActiveDirectoryGroup> groupFactory = new GroupFactory(row); WindowsAzureActiveDirectoryGroup group = groupFactory.Create(); group.Apply(patch); ColumnsFactory <WindowsAzureActiveDirectoryGroup> groupColumnsFactory = new GroupColumnsFactory(group); IReadOnlyDictionary <string, string> result = groupColumnsFactory.CreateColumns(); return(result); }
public override async Task UpdateAsync(IPatch patch, string correlationIdentifier) { if (null == patch) { throw new ArgumentNullException(nameof(patch)); } if (null == patch.ResourceIdentifier) { throw new ArgumentException(SqlProviderResources.ExceptionInvalidPatch); } if (string.IsNullOrWhiteSpace(patch.ResourceIdentifier.Identifier)) { throw new ArgumentException(SqlProviderResources.ExceptionInvalidPatch); } if (null == patch.PatchRequest) { throw new ArgumentException(SqlProviderResources.ExceptionInvalidPatch); } PatchRequest2 patchRequest = patch.PatchRequest as PatchRequest2; if (null == patchRequest) { string unsupportedPatchTypeName = patch.GetType().FullName; throw new NotSupportedException(unsupportedPatchTypeName); } Core2EnterpriseUser user = await this.context.Users.Where(u => u.Identifier == patch.ResourceIdentifier.Identifier) .Include(u => u.Addresses) .Include(u => u.ElectronicMailAddresses) .Include(u => u.InstantMessagings) .Include(u => u.PhoneNumbers) .FirstOrDefaultAsync(); if (user == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } user.Apply(patchRequest); this.context.Users.Update(user); await this.context.SaveChangesAsync(); }
public override Task UpdateAsync(IPatch patch, string correlationIdentifier) { if (null == patch) { throw new ArgumentNullException(nameof(patch)); } if (null == patch.ResourceIdentifier) { throw new ArgumentException(SampleServiceResources.ExceptionInvalidPatch); } if (string.IsNullOrWhiteSpace(patch.ResourceIdentifier.Identifier)) { throw new ArgumentException(SampleServiceResources.ExceptionInvalidPatch); } if (null == patch.PatchRequest) { throw new ArgumentException(SampleServiceResources.ExceptionInvalidPatch); } PatchRequest2 patchRequest = patch.PatchRequest as PatchRequest2; if (null == patchRequest) { string unsupportedPatchTypeName = patch.GetType().FullName; throw new NotSupportedException(unsupportedPatchTypeName); } if (this.storage.Groups.TryGetValue(patch.ResourceIdentifier.Identifier, out Core2Group group)) { group.Apply(patchRequest); } else { throw new HttpResponseException(HttpStatusCode.NotFound); } return(Task.CompletedTask); }
public override async Task UpdateAsync(IPatch patch, string correlationIdentifier) { if (null == patch) { throw new ArgumentNullException(nameof(patch)); } if (null == patch.ResourceIdentifier) { throw new ArgumentException("Invalid Patch"); } if (string.IsNullOrWhiteSpace(patch.ResourceIdentifier.Identifier)) { throw new ArgumentException("Invalid Patch"); } if (null == patch.PatchRequest) { throw new ArgumentException("Invalid Patch"); } PatchRequest2 patchRequest = patch.PatchRequest as PatchRequest2; if (null == patchRequest) { string unsupportedPatchTypeName = patch.GetType().FullName; throw new NotSupportedException(unsupportedPatchTypeName); } if (int.TryParse(patch.ResourceIdentifier.Identifier, out int id) && _context.Users.Find(id) is MvcMovie.Models.User modelUser) { Core2EnterpriseUser scimUser = (Core2EnterpriseUser)modelUser; scimUser.Apply(patchRequest); await ReplaceAsync(scimUser, correlationIdentifier); } else { throw new HttpResponseException(HttpStatusCode.NotFound); } }
private static IReadOnlyDictionary <string, string> PatchDynamicUser(PatchRequest2 patch, IRow row) { DynamicUser dynamicUser = new DynamicUserFactory(row).Create(); Dictionary <string, string> result = new DynamicUserColumnsFactory(dynamicUser) .CreateColumns() .ToDictionary( (KeyValuePair <string, string> item) => item.Key, (KeyValuePair <string, string> item) => item.Value); if (null == patch.Operations || !patch.Operations.Any()) { return(result); } foreach (PatchOperation operation in patch.Operations) { if (string.IsNullOrWhiteSpace(operation?.Path?.AttributePath)) { continue; } string updatedValue = operation.Value.First().Value; string originalValue; if (!result.TryGetValue(operation.Path.AttributePath, out originalValue)) { result.Add(operation.Path.AttributePath, updatedValue); } else { result[operation.Path.AttributePath] = updatedValue; } } return(result); }
public override Task UpdateAsync(IPatch patch, string correlationIdentifier) { if (null == patch) { throw new ArgumentNullException(nameof(patch)); } if (null == patch.ResourceIdentifier) { throw new ArgumentException(SampleServiceResources.ExceptionInvalidPatch); } if (string.IsNullOrWhiteSpace(patch.ResourceIdentifier.Identifier)) { throw new ArgumentException(SampleServiceResources.ExceptionInvalidPatch); } if (null == patch.PatchRequest) { throw new ArgumentException(SampleServiceResources.ExceptionInvalidPatch); } PatchRequest2 patchRequest = patch.PatchRequest as PatchRequest2; if (null == patchRequest) { string unsupportedPatchTypeName = patch.GetType().FullName; throw new NotSupportedException(unsupportedPatchTypeName); } // call service TargetGroup target; try { // get group target = _storageService.RetrieveGroup(new Guid(patch.ResourceIdentifier.Identifier)); // patch group Core2Group patched = (Core2Group)target; patched.Apply(patchRequest); // update user _storageService.UpdateGroup((TargetGroup)patched); } catch (Exception err) { switch (err.Message) { case "Conflict": throw new HttpResponseException(HttpStatusCode.Conflict); case "NotFound": throw new HttpResponseException(HttpStatusCode.NotFound); case "InvalidMemberType": throw new HttpResponseException(HttpStatusCode.NotAcceptable); default: throw new HttpResponseException(HttpStatusCode.InternalServerError); } } return(Task.CompletedTask); }
private async Task UpdateMembersAsync(Resource resource, IPatch patch) { if (null == resource) { throw new ArgumentNullException(nameof(resource)); } if (null == patch) { throw new ArgumentNullException(nameof(patch)); } if (null == patch.ResourceIdentifier) { throw new ArgumentException(FileProviderResources.ExceptionInvalidPatch); } if (string.IsNullOrWhiteSpace(patch.ResourceIdentifier.Identifier)) { throw new ArgumentException(FileProviderResources.ExceptionInvalidPatch); } if (string.IsNullOrWhiteSpace(patch.ResourceIdentifier.SchemaIdentifier)) { throw new ArgumentException(FileProviderResources.ExceptionInvalidPatch); } if (null == patch.PatchRequest) { throw new ArgumentException(FileProviderResources.ExceptionInvalidPatch); } PatchRequest2 patchRequest = patch.PatchRequest as PatchRequest2; if (null == patchRequest) { string unsupportedPatchTypeName = patch.GetType().FullName; throw new NotSupportedException(unsupportedPatchTypeName); } if ( !FileProvider .SchemaIdentifiersGroup .Value .Any( (string item) => string.Equals(item, patch.ResourceIdentifier.SchemaIdentifier, StringComparison.Ordinal)) ) { return; } IReadOnlyCollection <PatchOperation> memberOperations = patchRequest .Operations .Where( (PatchOperation item) => item.Path != null && string.Equals(item.Path.AttributePath, AttributeNames.Members, StringComparison.Ordinal)) .ToArray(); if (!memberOperations.Any()) { return; } foreach (PatchOperation memberOperation in memberOperations) { if (null == memberOperation.Value) { continue; } foreach (OperationValue value in memberOperation.Value) { if (string.IsNullOrWhiteSpace(value.Value)) { continue; } Dictionary <string, string> columnsQuery = new Dictionary <string, string>() { { AttributeNames.Schemas, patch.ResourceIdentifier.SchemaIdentifier }, { AttributeNames.Identifier, patch.ResourceIdentifier.Identifier }, { AttributeNames.Members, value.Value } }; IRow[] rows = await this.file.Query(columnsQuery); switch (memberOperation.Name) { case OperationName.Add: if (rows.Any()) { break; } Member member = new Member() { Value = value.Value }; MemberColumnsFactory memberColumnsFactory = new MemberColumnsFactory(resource, member); IReadOnlyDictionary <string, string> columnsMember = memberColumnsFactory.CreateColumns(); await this.file.InsertRow(columnsMember); break; case OperationName.Remove: foreach (IRow row in rows) { await this.file.RemoveRow(row.Key); } break; } } } }
public override async Task UpdateAsync(IPatch patch, string correlationIdentifier) { if (null == patch) { throw new ArgumentNullException(nameof(patch)); } if (null == patch.ResourceIdentifier) { throw new ArgumentException(FileProviderResources.ExceptionInvalidPatch); } if (string.IsNullOrWhiteSpace(patch.ResourceIdentifier.Identifier)) { throw new ArgumentException(FileProviderResources.ExceptionInvalidPatch); } if (null == patch.PatchRequest) { throw new ArgumentException(FileProviderResources.ExceptionInvalidPatch); } IInformationNotification notification = VerboseInformationNotificationFactory.Instance.FormatNotification( FileProviderResources.InformationPatching, correlationIdentifier, FileProvider.NotificationIdentifierUpdateStarting, patch.ResourceIdentifier.SchemaIdentifier, patch.ResourceIdentifier.Identifier); this.Monitor.Inform(notification); PatchRequest2 patchRequest = patch.PatchRequest as PatchRequest2; if (null == patchRequest) { string unsupportedPatchTypeName = patch.GetType().FullName; throw new NotSupportedException(unsupportedPatchTypeName); } IRow row = await this.file.ReadRow(patch.ResourceIdentifier.Identifier); string rowSchema = null; if ( !row.Columns.TryGetValue(AttributeNames.Schemas, out rowSchema) || !string.Equals(rowSchema, patch.ResourceIdentifier.SchemaIdentifier, StringComparison.Ordinal) ) { return; } IReadOnlyDictionary <string, string> columns = FileProvider.Apply(patchRequest, rowSchema, row); IRow rowReplacement = new Row(row.Key, columns); await this.file.ReplaceRow(rowReplacement); if (string.Equals(SchemaIdentifiers.WindowsAzureActiveDirectoryGroup, rowSchema, StringComparison.OrdinalIgnoreCase)) { WindowsAzureActiveDirectoryGroup group = new GroupFactory(row).Create(); await this.UpdateMembersAsync(group, patch); } }
public PatchRequest2 ComposeUserPatch() { string value = Guid.NewGuid().ToString(SampleComposer.FormatUniqueIdentifierCompressed); IPath path; PatchOperation operation; OperationValue operationValue; PatchRequest2 result = new PatchRequest2(); Assert.IsTrue(Path.TryParse(AttributeNames.Active, out path)); operationValue = new OperationValue() { Value = bool.FalseString }; operation = new PatchOperation() { 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 PatchOperation() { 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 PatchOperation() { 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 PatchOperation() { Name = OperationName.Replace, Path = path }; operation.AddValue(operationValue); result.AddOperation(operation); return(result); }
public void TestLifecycleGroup() { Uri addressBase = new Uri(WebServiceUnitTest.AddressBase); IMonitor monitor = new ConsoleMonitor(); IAmazonWebServicesIdentityAnchoringBehavior anchoringBehavior = new AnchoringByIdentifierBehavior(); AmazonWebServicesProviderBase provider = new AmazonWebServicesProvider(WebServiceUnitTest.CredentialsProfileName, anchoringBehavior); Service webService = null; try { webService = new WebService(monitor, provider); webService.Start(addressBase); string identifierGroup; string identifierGroupExternal; string identifierMemberOne; string identifierMemberTwo; Uri resource; WebClient client = null; try { IDictionary<string, object> json; string characters; byte[] bytes; byte[] response; string responseCharacters; IReadOnlyDictionary<string, object> responseJson; Core2EnterpriseUser user; Member member; IReadOnlyCollection<Member> members; client = new WebClient(); identifierMemberOne = Guid.NewGuid().ToString(); string identifierMemberOneExternal = Guid.NewGuid().ToString(); user = new Core2EnterpriseUser() { Identifier = identifierMemberOne, ExternalIdentifier = identifierMemberOneExternal }; json = user.ToJson(); characters = WebServiceUnitTest.Serializer.Value.Serialize(json); bytes = Encoding.UTF8.GetBytes(characters); resource = new Uri(addressBase, WebServiceUnitTest.AddressRelativeUsers); client.Headers.Clear(); client.Headers.Add(HttpRequestHeader.ContentType, WebServiceUnitTest.ContentTypeJson); response = client.UploadData(resource.AbsoluteUri, WebRequestMethods.Http.Post, bytes); responseCharacters = Encoding.UTF8.GetString(response); responseJson = WebServiceUnitTest.Serializer.Value.Deserialize<Dictionary<string, object>>(responseCharacters); user = new Core2EnterpriseUserJsonDeserializingFactory().Create(responseJson); identifierMemberOne = user.Identifier; try { member = new Member() { Value = identifierMemberOne }; members = new Member[] { member }; identifierGroup = Guid.NewGuid().ToString(); identifierGroupExternal = Guid.NewGuid().ToString(); WindowsAzureActiveDirectoryGroup group = new WindowsAzureActiveDirectoryGroup() { Identifier = identifierGroup, ExternalIdentifier = identifierGroupExternal, Members = members }; json = group.ToJson(); characters = WebServiceUnitTest.Serializer.Value.Serialize(json); bytes = Encoding.UTF8.GetBytes(characters); resource = new Uri(addressBase, WebServiceUnitTest.AddressRelativeGroups); client.Headers.Clear(); client.Headers.Add(HttpRequestHeader.ContentType, WebServiceUnitTest.ContentTypeJson); response = client.UploadData(resource.AbsoluteUri, WebRequestMethods.Http.Post, bytes); responseCharacters = Encoding.UTF8.GetString(response); responseJson = WebServiceUnitTest.Serializer.Value.Deserialize<Dictionary<string, object>>(responseCharacters); group = new WindowsAzureActiveDirectoryGroupJsonDeserializingFactory().Create(responseJson); Assert.IsNotNull(group); Assert.IsNotNull( group .Schemas .SingleOrDefault( (string item) => string.Equals( SchemaIdentifiers.WindowsAzureActiveDirectoryGroup, item, StringComparison.Ordinal))); Assert.IsFalse(string.IsNullOrWhiteSpace(group.Identifier)); string identifierGroupAmazon = group.Identifier; try { Assert.IsNotNull(group.Metadata); Assert.IsFalse(string.IsNullOrWhiteSpace(group.Metadata.ResourceType)); Assert.IsFalse(string.Equals(identifierGroup, identifierGroupAmazon, StringComparison.OrdinalIgnoreCase)); string resourcePath = string.Format( CultureInfo.InvariantCulture, WebServiceUnitTest.AddressRelativeGroupTemplate, identifierGroupAmazon); resource = new Uri(addressBase, resourcePath); response = client.DownloadData(resource); responseCharacters = Encoding.UTF8.GetString(response); responseJson = WebServiceUnitTest.Serializer.Value.Deserialize<Dictionary<string, object>>(responseCharacters); group = new WindowsAzureActiveDirectoryGroupJsonDeserializingFactory().Create(responseJson); Assert.IsNotNull(group); Assert.IsNotNull( group .Schemas .SingleOrDefault( (string item) => string.Equals( SchemaIdentifiers.Core2Group, item, StringComparison.Ordinal))); Assert.IsFalse(string.IsNullOrWhiteSpace(group.Identifier)); Assert.IsTrue(string.Equals(group.Identifier, identifierGroupAmazon, StringComparison.OrdinalIgnoreCase)); Assert.IsFalse(string.IsNullOrWhiteSpace(group.ExternalIdentifier)); Assert.IsTrue(string.Equals(group.ExternalIdentifier, identifierGroupExternal, StringComparison.OrdinalIgnoreCase)); identifierMemberTwo = Guid.NewGuid().ToString(); string identifierMemberTwoExternal = Guid.NewGuid().ToString(); user = new Core2EnterpriseUser() { Identifier = identifierMemberTwo, ExternalIdentifier = identifierMemberTwoExternal }; json = user.ToJson(); characters = WebServiceUnitTest.Serializer.Value.Serialize(json); bytes = Encoding.UTF8.GetBytes(characters); resource = new Uri(addressBase, WebServiceUnitTest.AddressRelativeUsers); client.Headers.Clear(); client.Headers.Add(HttpRequestHeader.ContentType, WebServiceUnitTest.ContentTypeJson); response = client.UploadData(resource.AbsoluteUri, WebRequestMethods.Http.Post, bytes); responseCharacters = Encoding.UTF8.GetString(response); responseJson = WebServiceUnitTest.Serializer.Value.Deserialize<Dictionary<string, object>>(responseCharacters); user = new Core2EnterpriseUserJsonDeserializingFactory().Create(responseJson); identifierMemberTwo = user.Identifier; try { IResourceIdentifier resourceIdentifier = new ResourceIdentifier() { Identifier = identifierGroupAmazon, SchemaIdentifier = SchemaIdentifiers.WindowsAzureActiveDirectoryGroup }; IPath path = Microsoft.SystemForCrossDomainIdentityManagement.Path.Create(AttributeNames.Members); OperationValue operationValue; PatchOperation operation; IReadOnlyCollection<PatchOperation> operations; PatchRequest2 patch; operationValue = new OperationValue() { Value = identifierMemberTwo }; operation = new PatchOperation() { Name = OperationName.Add, Path = path }; operations = new PatchOperation[] { operation }; operation.AddValue(operationValue); patch = new PatchRequest2(); patch.AddOperation(operation); json = patch.ToJson(); characters = WebServiceUnitTest.Serializer.Value.Serialize(json); bytes = Encoding.UTF8.GetBytes(characters); resourcePath = string.Concat(WebServiceUnitTest.AddressRelativeGroup, identifierGroupAmazon); resource = new Uri(addressBase, resourcePath); client.Headers.Clear(); client.Headers.Add(HttpRequestHeader.ContentType, WebServiceUnitTest.ContentTypeJson); response = client.UploadData(resource.AbsoluteUri, WebServiceUnitTest.MethodPatch, bytes); operationValue = new OperationValue() { Value = identifierMemberTwo }; operation = new PatchOperation() { Name = OperationName.Remove, Path = path }; operations = new PatchOperation[] { operation }; operation.AddValue(operationValue); patch = new PatchRequest2(); patch.AddOperation(operation); json = patch.ToJson(); characters = WebServiceUnitTest.Serializer.Value.Serialize(json); bytes = Encoding.UTF8.GetBytes(characters); resourcePath = string.Concat(WebServiceUnitTest.AddressRelativeGroup, identifierGroupAmazon); resource = new Uri(addressBase, resourcePath); client.Headers.Clear(); client.Headers.Add(HttpRequestHeader.ContentType, WebServiceUnitTest.ContentTypeJson); response = client.UploadData(resource.AbsoluteUri, WebServiceUnitTest.MethodPatch, bytes); operationValue = new OperationValue() { Value = identifierMemberOne }; operation = new PatchOperation() { Name = OperationName.Remove, Path = path }; operations = new PatchOperation[] { operation }; operation.AddValue(operationValue); patch = new PatchRequest2(); patch.AddOperation(operation); json = patch.ToJson(); characters = WebServiceUnitTest.Serializer.Value.Serialize(json); bytes = Encoding.UTF8.GetBytes(characters); resourcePath = string.Concat(WebServiceUnitTest.AddressRelativeGroup, identifierGroupAmazon); resource = new Uri(addressBase, resourcePath); client.Headers.Clear(); client.Headers.Add(HttpRequestHeader.ContentType, WebServiceUnitTest.ContentTypeJson); response = client.UploadData(resource.AbsoluteUri, WebServiceUnitTest.MethodPatch, bytes); } finally { resourcePath = string.Concat(WebServiceUnitTest.AddressRelativeUser, identifierMemberTwo); resource = new Uri(addressBase, resourcePath); bytes = new byte[0]; client.UploadData(resource, WebServiceUnitTest.MethodDelete, bytes); } } finally { string resourcePath = string.Concat(WebServiceUnitTest.AddressRelativeGroup, identifierGroupAmazon); resource = new Uri(addressBase, resourcePath); bytes = new byte[0]; client.UploadData(resource, WebServiceUnitTest.MethodDelete, bytes); } } finally { string resourcePath = string.Concat(WebServiceUnitTest.AddressRelativeUser, identifierMemberOne); resource = new Uri(addressBase, resourcePath); bytes = new byte[0]; client.UploadData(resource, WebServiceUnitTest.MethodDelete, bytes); } } finally { if (client != null) { client.Dispose(); client = null; } } } finally { if (webService != null) { webService.Dispose(); webService = null; } } }