DeployToAzure.Management.AzureManagementLowLevelApi.BeginCreate C# (CSharp) Method

BeginCreate() public method

public BeginCreate ( DeploymentSlotUri deploymentUri, IDeploymentConfiguration configuration ) : RequestUri
deploymentUri DeploymentSlotUri
configuration IDeploymentConfiguration
return RequestUri
        public RequestUri BeginCreate(DeploymentSlotUri deploymentUri, IDeploymentConfiguration configuration)
        {
            OurTrace.TraceVerbose("BeginCreate");
            var xml = configuration.MakeCreateDeploymentMessage();
            OurTrace.TraceInfo(xml);

            var response = _http.Post(deploymentUri.ToString(), xml);
            var statusCode = response.StatusCode;

            if (statusCode.IsAccepted())
                return deploymentUri.ToRequestUri(response.AzureRequestIdHeader);

            if (statusCode.IsConflict())
                return null;

            ThrowUnexpectedHttpResponse(response);
            return null; // can't be reached.
        }

Usage Example

        public void Http409ConflictReturnsNull()
        {
            var http = new ScriptedHttpFake();

            http.Script.Add(() => http.NextResponse = new HttpResponse(HttpStatusCode.Conflict, ""));

            var api = new AzureManagementLowLevelApi(http);
            var config = MockRepository.GenerateStub<IDeploymentConfiguration>();
            Assert.That(api.BeginCreate(TestDeploymentUri, config), Is.Null, "Should return null on 409 conflict");
        }
All Usage Examples Of DeployToAzure.Management.AzureManagementLowLevelApi::BeginCreate