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)); }
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)); }
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)); }
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)); }