protected override void BeginProcessing() { try { var dcApi = new DataCenterApi(Utilities.Configuration); if ((string.IsNullOrWhiteSpace(Name) || string.IsNullOrEmpty(Name)) && (string.IsNullOrWhiteSpace(Description) || string.IsNullOrEmpty(Description))) { WriteError(new ErrorRecord(new Exception("Please provide Name or Description to update Virtual data center."), "", ErrorCategory.InvalidArgument, "")); } else { var dc = new DatacenterProperties(); if (!(string.IsNullOrWhiteSpace(Name) && string.IsNullOrEmpty(Name))) { dc.Name = Name; } if (!(string.IsNullOrWhiteSpace(Description) && string.IsNullOrEmpty(Description))) { dc.Description = Description; } var resp = dcApi.PartialUpdate(this.DataCenterId, dc); WriteObject(resp); } } catch (Exception ex) { WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); } }
public void DataCenterUpdate() { Configure(); var resp = dcApi.PartialUpdate(datacenter.Id, new DatacenterProperties { Name = datacenter.Properties.Name + " - updated" }); Assert.AreNotEqual(datacenter.Properties.Name, resp.Properties.Name); }