public async Task ProvisionDeferred()
        {
            var request = new ServiceInstanceProvisionRequest
            {
                ServiceId = "abc",
                PlanId    = "xyz"
            };
            var response = new ServiceInstanceAsyncOperation
            {
                Operation    = "my operation",
                DashboardUrl = new Uri("http://example.com")
            };
            var operation = new LastOperationResource
            {
                State       = LastOperationResourceState.Succeeded,
                Description = "done"
            };
            var syntheticResponse = new ServiceInstanceProvision
            {
                DashboardUrl = response.DashboardUrl
            };

            SetupMock(x => x.ProvisionAsync(new ServiceInstanceContext("123"), request), response);
            SetupMock(x => x.GetLastOperationAsync(new ServiceInstanceContext("123"), "abc", "xyz", "my operation"), operation);
            var result = await Client.ServiceInstancesPolling["123"].ProvisionAsync(request);

            result.Should().BeEquivalentTo(syntheticResponse);
        }
Ejemplo n.º 2
0
        public async Task Provision()
        {
            var request = new ServiceInstanceProvisionRequest
            {
                ServiceId = "abc",
                PlanId    = "xyz"
            };
            var response = new ServiceInstanceProvision
            {
                DashboardUrl = new Uri("http://example.com")
            };

            SetupMock(x => x.ProvisionAsync(new ServiceInstanceContext("123"), request), response);
            var result = await Client.ServiceInstancesBlocking["123"].ProvisionAsync(request);

            result.Should().BeEquivalentTo(response);
        }
Ejemplo n.º 3
0
        public async Task Provision()
        {
            var request = new ServiceInstanceProvisionRequest
            {
                ServiceId        = "abc",
                PlanId           = "xyz",
                OrganizationGuid = "org",
                SpaceGuid        = "space"
            };
            var response = new ServiceInstanceProvision
            {
                DashboardUrl = new Uri("http://example.com")
            };

            Mock.Setup(x => x.ProvisionAsync(new("123"), request))
            .ReturnsAsync(response);
            var result = await Client.ServiceInstancesBlocking["123"].ProvisionAsync(request);

            result.Should().BeEquivalentTo(response);
        }
        public async Task ProvisionCompleted()
        {
            var request = new ServiceInstanceProvisionRequest
            {
                ServiceId        = "abc",
                PlanId           = "xyz",
                OrganizationGuid = "org",
                SpaceGuid        = "space"
            };
            var syntheticResponse = new ServiceInstanceProvision
            {
                DashboardUrl = new Uri("http://example.com")
            };
            var response = new ServiceInstanceAsyncOperation().Complete(syntheticResponse);

            SetupMock(x => x.ProvisionAsync(new ServiceInstanceContext("123"), request), response);
            var result = await Client.ServiceInstancesPolling["123"].ProvisionAsync(request);

            result.Should().BeEquivalentTo(syntheticResponse);
        }