/// <summary> /// /// </summary> /// <param name="svc"></param> /// <param name="expLabel"></param> /// <param name="expLocation"></param> /// <param name="expAff"></param> /// <param name="expDescription"></param> /// <param name="expStatus"></param> /// <returns></returns> internal static bool AzureService(string svc, string expLabel, string expLocation = "West US", string expAff = null, string expDescription = null, string expStatus = "Created") { try { HostedServiceDetailedContext result = vmPowershellCmdlets.GetAzureService(svc); Assert.AreEqual(expLabel, result.Label); Assert.AreEqual(expDescription, result.Description); Assert.AreEqual(expAff, result.AffinityGroup); Assert.AreEqual(expLocation, result.Location); Assert.AreEqual(expStatus, result.Status); Assert.AreEqual(svc, result.ServiceName); //Assert.AreEqual(expDateCreated, result.DateCreated); //Assert.AreEqual(expDateModified, result.DateModified); //Assert.AreEqual(expUrl, result.Url); return(true); } catch (Exception e) { Console.WriteLine(e.ToString()); return(false); } }
protected override void ProcessRecord() { try { Func <HostedService, HostedServiceDetailedContext> func = null; base.ProcessRecord(); Operation operation = null; IEnumerable <HostedService> hostedServiceProcess = this.GetHostedServiceProcess(out operation); if (hostedServiceProcess != null) { IEnumerable <HostedService> hostedServices = hostedServiceProcess; if (func == null) { func = (HostedService service) => { string serviceName; string empty; string str; string serviceName1; if (this.ServiceName == null) { HostedServiceDetailedContext hostedServiceDetailedContext = new HostedServiceDetailedContext(); HostedServiceDetailedContext hostedServiceDetailedContext1 = hostedServiceDetailedContext; if (service.ServiceName != null) { serviceName = service.ServiceName; } else { serviceName = this.ServiceName; } hostedServiceDetailedContext1.ServiceName = serviceName; hostedServiceDetailedContext.Url = service.Url; HostedServiceDetailedContext hostedServiceDetailedContext2 = hostedServiceDetailedContext; if (string.IsNullOrEmpty(service.HostedServiceProperties.Label)) { empty = string.Empty; } else { empty = ServiceManagementHelper.DecodeFromBase64String(service.HostedServiceProperties.Label); } hostedServiceDetailedContext2.Label = empty; hostedServiceDetailedContext.Description = service.HostedServiceProperties.Description; hostedServiceDetailedContext.Location = service.HostedServiceProperties.Location; hostedServiceDetailedContext.Status = service.HostedServiceProperties.Status; hostedServiceDetailedContext.DateCreated = service.HostedServiceProperties.DateCreated; hostedServiceDetailedContext.DateModified = service.HostedServiceProperties.DateLastModified; hostedServiceDetailedContext.AffinityGroup = service.HostedServiceProperties.AffinityGroup; hostedServiceDetailedContext.set_OperationId(operation.OperationTrackingId); hostedServiceDetailedContext.set_OperationDescription(this.CommandRuntime.ToString()); hostedServiceDetailedContext.set_OperationStatus(operation.Status); return(hostedServiceDetailedContext); } else { if (string.IsNullOrEmpty(service.HostedServiceProperties.Label)) { str = string.Empty; } else { str = ServiceManagementHelper.DecodeFromBase64String(service.HostedServiceProperties.Label); } string str1 = str; HostedServiceDetailedContext url = new HostedServiceDetailedContext(); HostedServiceDetailedContext hostedServiceDetailedContext3 = url; if (service.ServiceName != null) { serviceName1 = service.ServiceName; } else { serviceName1 = this.ServiceName; } hostedServiceDetailedContext3.ServiceName = serviceName1; url.Url = service.Url; url.Label = str1; url.Description = service.HostedServiceProperties.Description; url.AffinityGroup = service.HostedServiceProperties.AffinityGroup; url.Location = service.HostedServiceProperties.Location; url.Status = service.HostedServiceProperties.Status; url.DateCreated = service.HostedServiceProperties.DateCreated; url.DateModified = service.HostedServiceProperties.DateLastModified; url.set_OperationId(operation.OperationTrackingId); url.set_OperationDescription(this.CommandRuntime.ToString()); url.set_OperationStatus(operation.Status); return(url); } } ; } IEnumerable <HostedServiceDetailedContext> hostedServiceDetailedContexts = hostedServices.Select <HostedService, HostedServiceDetailedContext>(func); base.WriteObject(hostedServiceDetailedContexts, true); } } catch (Exception exception1) { Exception exception = exception1; base.WriteError(new ErrorRecord(exception, string.Empty, ErrorCategory.CloseError, null)); } }