public void ServerCreateSyncValidateMessage()
        {
            var acceptedResponse = new HttpResponseMessage(HttpStatusCode.Created)
            {
                Content = new StringContent(AnalysisServicesTestUtilities.GetDefaultCreatedResponse("Provisioning", "Provisioning"))
            };

            acceptedResponse.Headers.Add("x-ms-request-id", "1");
            acceptedResponse.Headers.Add("Location", @"http://someLocationURL");

            var okResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(AnalysisServicesTestUtilities.GetDefaultCreatedResponse("Succeeded", "Succeeded"))
            };

            var handler = new RecordedDelegatingHandler(new HttpResponseMessage[] { acceptedResponse, okResponse });

            AnalysisServicesManagementClient client = AnalysisServicesTestUtilities.GetAnalysisServicesClient(handler);
            AnalysisServicesServer           analysisServicesResource = AnalysisServicesTestUtilities.GetDefaultAnalysisServicesResource();

            var result = client.Servers.Create(
                AnalysisServicesTestUtilities.DefaultResourceGroup,
                AnalysisServicesTestUtilities.DefaultServerName,
                analysisServicesResource
                );

            // Validate headers - User-Agent for certs, Authorization for tokens
            Assert.Equal(HttpMethod.Put, handler.Requests[0].Method);
            Assert.NotNull(handler.Requests[0].Headers.GetValues("User-Agent"));

            // Validate result
            Assert.Equal(result.Location, AnalysisServicesTestUtilities.DefaultLocation);
            Assert.NotEmpty(result.ServerFullName);
            Assert.Equal("Succeeded", result.ProvisioningState);
            Assert.Equal("Succeeded", result.State);
            Assert.Equal(2, result.Tags.Count);
            Assert.Equal(result.BackupBlobContainerUri, AnalysisServicesTestUtilities.DefaultBackupBlobContainerUri);
        }
        public void ServerUpdateValidateMessage()
        {
            var okResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(AnalysisServicesTestUtilities.GetDefaultCreatedResponse("Succeeded", "Succeeded"))
            };

            var handler = new RecordedDelegatingHandler(new HttpResponseMessage[] { okResponse });

            AnalysisServicesManagementClient       client           = AnalysisServicesTestUtilities.GetAnalysisServicesClient(handler);
            AnalysisServicesServerUpdateParameters updateParameters = new AnalysisServicesServerUpdateParameters()
            {
                Sku                    = AnalysisServicesTestUtilities.DefaultSku,
                Tags                   = AnalysisServicesTestUtilities.DefaultTags,
                AsAdministrators       = new ServerAdministrators(AnalysisServicesTestUtilities.DefaultAdministrators),
                BackupBlobContainerUri = AnalysisServicesTestUtilities.DefaultBackupBlobContainerUri
            };

            var result = client.Servers.Update(
                AnalysisServicesTestUtilities.DefaultResourceGroup,
                AnalysisServicesTestUtilities.DefaultServerName,
                updateParameters
                );

            // Validate headers - User-Agent for certs, Authorization for tokens
            Assert.Equal(new HttpMethod("PATCH"), handler.Requests[0].Method);
            Assert.NotNull(handler.Requests[0].Headers.GetValues("User-Agent"));

            // Validate result
            Assert.Equal(result.Location, AnalysisServicesTestUtilities.DefaultLocation);
            Assert.NotEmpty(result.ServerFullName);
            Assert.Equal("Succeeded", result.ProvisioningState);
            Assert.Equal("Succeeded", result.State);
            Assert.Equal(2, result.Tags.Count);
            Assert.Equal(result.BackupBlobContainerUri, AnalysisServicesTestUtilities.DefaultBackupBlobContainerUri);
        }