public async Task Fetch() { var response = new ServiceBindingResource(); SetupMock(x => x.FetchAsync("123", "456"), response); var result = await Client.ServiceInstancesBlocking["123"].ServiceBindings["456"].FetchAsync(); result.Should().BeEquivalentTo(response); }
public async Task Fetch() { var response = new ServiceBindingResource(); Mock.Setup(x => x.FetchAsync("123", "456")) .ReturnsAsync(response); var result = await Client.ServiceInstancesDeferred["123"].ServiceBindings["456"].FetchAsync(); result.Should().BeEquivalentTo(response); }
public async Task BindDeferred() { var request = new ServiceBindingRequest { ServiceId = "abc", PlanId = "xyz", BindResource = new() { AppGuid = "123-456" } }; var response = new ServiceBindingAsyncOperation { Operation = "my operation" }; var operation = new LastOperationResource { State = LastOperationResourceState.Succeeded, Description = "done" }; var resource = new ServiceBindingResource { RouteServiceUrl = new Uri("http://example.com") }; var syntheticResponse = new ServiceBinding { RouteServiceUrl = new Uri("http://example.com") }; Mock.Setup(x => x.BindAsync(new("123", "456"), request)) .ReturnsAsync(response); Mock.Setup(x => x.GetLastOperationAsync(new("123", "456"), "abc", "xyz", "my operation")) .ReturnsAsync(operation); Mock.Setup(x => x.FetchAsync("123", "456")) .ReturnsAsync(resource); var result = await Client.ServiceInstancesPolling["123"].ServiceBindings["456"].BindAsync(request); result.Should().BeEquivalentTo(syntheticResponse); }