Microsoft.WindowsAzure.Commands.Test.Utilities.Common.ClientMocks.Make404Exception C# (CSharp) Method

Make404Exception() static private method

static private Make404Exception ( ) : CloudException
return CloudException
        internal static CloudException Make404Exception()
        {
            return CloudException.CreateFromXml(
                new HttpRequestMessage(),
                null,
                new HttpResponseMessage(HttpStatusCode.NotFound),
                "<Error><Message>Not found</Message></Error>");
        }
    }

Usage Example

Esempio n. 1
0
        private Task <DeploymentGetResponse> CreateDeploymentGetResponse(string serviceName, DeploymentSlot slot)
        {
            var service        = Services.FirstOrDefault(s => s.Name == serviceName);
            var failedResponse = Tasks.FromException <DeploymentGetResponse>(ClientMocks.Make404Exception());

            if (service == null)
            {
                return(failedResponse);
            }

            if (slot == DeploymentSlot.Production && service.ProductionDeployment == null ||
                slot == DeploymentSlot.Staging && service.StagingDeployment == null)
            {
                return(failedResponse);
            }

            var response = new DeploymentGetResponse
            {
                Name                 = serviceName,
                Configuration        = "config",
                DeploymentSlot       = slot,
                Status               = DeploymentStatus.Starting,
                PersistentVMDowntime = new PersistentVMDowntime
                {
                    EndTime   = DateTime.Now,
                    StartTime = DateTime.Now,
                    Status    = "",
                },
                LastModifiedTime = DateTime.Now
            };

            return(Tasks.FromResult(response));
        }
All Usage Examples Of Microsoft.WindowsAzure.Commands.Test.Utilities.Common.ClientMocks::Make404Exception