コード例 #1
0
            public void CallsServiceProvisionWithRequest()
            {
                service.Provision(Arg.Any <ProvisionRequest>()).ReturnsForAnyArgs(new ProvisionResponse {
                    Url = "http://foo"
                });
                string instanceId = Guid.NewGuid().ToString();

                IHttpActionResult result = controller.Provision(instanceId, new ProvisionRequest {
                    ServiceId = serviceId.ToString()
                });

                Assert.IsType <NegotiatedContentResult <ProvisionResponse> >(result);
                service.Received().Provision(Arg.Is <ProvisionRequest>(x => x.InstanceId == instanceId));
            }
コード例 #2
0
            public void CallsServiceDeprovisionWithInstanceId()
            {
                var instanceId = Guid.NewGuid().ToString();
                var planId     = Guid.NewGuid().ToString();

                IHttpActionResult result = controller.Deprovision(instanceId, serviceId.ToString(), planId);

                Assert.IsType <OkNegotiatedContentResult <EmptyResponse> >(result);
                service.Received().Deprovision(Arg.Is <DeprovisionRequest>(x => x.InstanceId == instanceId && x.ServiceId == serviceId.ToString() && x.PlanId == planId));
            }
コード例 #3
0
            public void CallsServiceCreateBindingAfterSettingInstanceIdAndBindingIdOnRequest()
            {
                var instanceId = Guid.NewGuid().ToString();
                var bindingId  = Guid.NewGuid().ToString();
                var planId     = Guid.NewGuid().ToString();

                IHttpActionResult result = controller.Unbind(instanceId, bindingId, serviceId.ToString(), planId);

                Assert.IsType <OkNegotiatedContentResult <EmptyResponse> >(result);
                service.Received().RemoveBinding(Arg.Is <RemoveBindingRequest>(x => x.BindingId == bindingId && x.InstanceId == instanceId && x.ServiceId == serviceId.ToString() && x.PlanId == planId));
            }
コード例 #4
0
            public void CallsServiceCreateBindingAfterSettingInstanceIdAndBindingIdOnRequest()
            {
                service.CreateBinding(Arg.Any <CreateBindingRequest>()).ReturnsForAnyArgs(new CreateBindingResponse {
                    LogUrl = "http://foo", Credentials = new Credentials()
                });
                var request = new CreateBindingRequest {
                    ServiceId = serviceId.ToString()
                };
                var instanceId = Guid.NewGuid().ToString();
                var bindingId  = Guid.NewGuid().ToString();

                IHttpActionResult result = controller.Bind(instanceId, bindingId, request);

                Assert.IsType <OkNegotiatedContentResult <CreateBindingResponse> >(result);
                service.Received().CreateBinding(Arg.Is <CreateBindingRequest>(x => x.BindingId == bindingId && x.InstanceId == instanceId));
            }