public void ThrowsOnAnythingOtherThanAccepted() { var http = new ScriptedHttpFake(); http.Script.Add(() => http.NextResponse = new HttpResponse(HttpStatusCode.ServiceUnavailable, "")); var api = new AzureManagementLowLevelApi(http); Assert.That(() => api.BeginSuspend(TestDeploymentUri), Throws.TypeOf<UnhandledHttpException>()); }
public void Http409ConflictReturnsNull() { var http = new ScriptedHttpFake(); http.Script.Add(() => http.NextResponse = new HttpResponse(HttpStatusCode.Conflict, "")); var api = new AzureManagementLowLevelApi(http); Assert.That(api.BeginSuspend(TestDeploymentUri), Is.Null, "RequestUri should be null on 409 conflict"); }
public void SendsCorrectPostArguments() { var http = new ScriptedHttpFake(); http.Script.Add(() => http.NextResponse = new HttpResponse(HttpStatusCode.Accepted, "")); var api = new AzureManagementLowLevelApi(http); api.BeginSuspend(TestDeploymentUri); Assert.That(http.LastPostUri, Is.EqualTo(TestDeploymentUri + "/?comp=status"), "deploymentUri parameter incorrect"); Assert.That(http.LastPostContent, Contains.Substring("<UpdateDeploymentStatus "), "is an updateDeploymentStatus request"); Assert.That(http.LastPostContent, Contains.Substring("<Status>Suspended</Status>"), "has the appropriate status"); }