public void CanBeCreatedWithControllerWithoutProperties(HttpStatusCode status, IJSendResponse response, [NoAutoProperties] TestableJSendApiController controller) { // Exercise system and verify outcome Action ctor = () => new JSendResult<IJSendResponse>(status, response, controller); ctor.ShouldNotThrow(); }
public void RequestIsCorrectlyInitialized(HttpStatusCode status, IJSendResponse response, HttpRequestMessage request) { // Exercise system var result = new JSendResult <IJSendResponse>(status, response, request); // Verify outcome result.Request.Should().Be(request); }
public void ResponseIsCorrectlyInitialized(HttpStatusCode code, IJSendResponse response, ApiController controller) { // Exercise system var result = new JSendResult <IJSendResponse>(code, response, controller); // Verify outcome result.Response.Should().BeSameAs(response); }
public void ExecuteThrowsWhenRequestHasNoContext(HttpStatusCode status, IJSendResponse response) { // Fixture setup var request = new HttpRequestMessage(); var result = new JSendResult<IJSendResponse>(status, response, request); // Exercise system and verify outcome result.Awaiting(r => r.ExecuteAsync(CancellationToken.None)) .ShouldThrow<InvalidOperationException>() .WithMessage(StringResources.Request_RequestContextMustNotBeNull); }
public void ExecuteThrowsWhenControllerHasNoRequest(HttpStatusCode status, IJSendResponse response, [NoAutoProperties] TestableJSendApiController controller) { // Fixture setup var result = new JSendResult<IJSendResponse>(status, response, controller); // Exercise system and verify outcome result.Awaiting(r => r.ExecuteAsync(CancellationToken.None)) .ShouldThrow<InvalidOperationException>() .WithMessage("ApiController.Request must not be null."); }
public void ExecuteThrowsWhenRequestHasNoContext(HttpStatusCode status, IJSendResponse response) { // Fixture setup var request = new HttpRequestMessage(); var result = new JSendResult <IJSendResponse>(status, response, request); // Exercise system and verify outcome result.Awaiting(r => r.ExecuteAsync(CancellationToken.None)) .ShouldThrow <InvalidOperationException>() .WithMessage(StringResources.Request_RequestContextMustNotBeNull); }
public void ExecuteThrowsWhenControllerHasNoRequest(HttpStatusCode status, IJSendResponse response, [NoAutoProperties] TestableJSendApiController controller) { // Fixture setup var result = new JSendResult <IJSendResponse>(status, response, controller); // Exercise system and verify outcome result.Awaiting(r => r.ExecuteAsync(CancellationToken.None)) .ShouldThrow <InvalidOperationException>() .WithMessage("ApiController.Request must not be null."); }
public void ExecuteThrowsWhenRequestContextHasNoConfiguration(HttpRequestMessage request, HttpStatusCode status, IJSendResponse response) { // Fixture setup var requestContext = new HttpRequestContext(); request.SetRequestContext(requestContext); var result = new JSendResult<IJSendResponse>(status, response, request); // Exercise system and verify outcome result.Awaiting(r => r.ExecuteAsync(CancellationToken.None)) .ShouldThrow<InvalidOperationException>() .WithMessage("HttpRequestContext.Configuration must not be null."); }
public void ExecuteThrowsWhenControllerHasNoJsonFormatter(HttpStatusCode status, IJSendResponse response, ApiController controller) { // Fixture setup var formatters = controller.Configuration.Formatters; formatters.OfType<JsonMediaTypeFormatter>().ToList() .ForEach(f => formatters.Remove(f)); var result = new JSendResult<IJSendResponse>(status, response, controller); // Exercise system and verify outcome result.Awaiting(r => r.ExecuteAsync(CancellationToken.None)) .ShouldThrow<InvalidOperationException>() .WithMessage(StringResources.ConfigurationMustContainFormatter); }
public void ExecuteThrowsWhenRequestContextHasNoConfiguration(HttpRequestMessage request, HttpStatusCode status, IJSendResponse response) { // Fixture setup var requestContext = new HttpRequestContext(); request.SetRequestContext(requestContext); var result = new JSendResult <IJSendResponse>(status, response, request); // Exercise system and verify outcome result.Awaiting(r => r.ExecuteAsync(CancellationToken.None)) .ShouldThrow <InvalidOperationException>() .WithMessage("HttpRequestContext.Configuration must not be null."); }
public void CanBeCreatedWithControllerWithoutProperties(HttpStatusCode status, IJSendResponse response, [NoAutoProperties] TestableJSendApiController controller) { // Exercise system and verify outcome Action ctor = () => new JSendResult <IJSendResponse>(status, response, controller); ctor.ShouldNotThrow(); }
public void RequestIsCorrectlyInitializedUsingController(HttpStatusCode status, IJSendResponse response, ApiController controller) { // Exercise system var result = new JSendResult <IJSendResponse>(status, response, controller); // Verify outcome result.Request.Should().Be(controller.Request); }
public void StatusCodeIsCorrectlyInitialized(HttpStatusCode expectedStatusCode, IJSendResponse response, ApiController controller) { // Exercise system var result = new JSendResult <IJSendResponse>(expectedStatusCode, response, controller); // Verify outcome result.StatusCode.Should().Be(expectedStatusCode); }
public void RequestIsCorrectlyInitialized(HttpStatusCode status, IJSendResponse response, HttpRequestMessage request) { // Exercise system var result = new JSendResult<IJSendResponse>(status, response, request); // Verify outcome result.Request.Should().Be(request); }
public void ResponseIsCorrectlyInitialized(HttpStatusCode code, IJSendResponse response, ApiController controller) { // Exercise system var result = new JSendResult<IJSendResponse>(code, response, controller); // Verify outcome result.Response.Should().BeSameAs(response); }
public void RequestIsCorrectlyInitializedUsingController(HttpStatusCode status, IJSendResponse response, ApiController controller) { // Exercise system var result = new JSendResult<IJSendResponse>(status, response, controller); // Verify outcome result.Request.Should().Be(controller.Request); }
public void ExecuteThrowsWhenControllerHasNoJsonFormatter(HttpStatusCode status, IJSendResponse response, ApiController controller) { // Fixture setup var formatters = controller.Configuration.Formatters; formatters.OfType <JsonMediaTypeFormatter>().ToList() .ForEach(f => formatters.Remove(f)); var result = new JSendResult <IJSendResponse>(status, response, controller); // Exercise system and verify outcome result.Awaiting(r => r.ExecuteAsync(CancellationToken.None)) .ShouldThrow <InvalidOperationException>() .WithMessage(StringResources.ConfigurationMustContainFormatter); }
public void StatusCodeIsCorrectlyInitialized(HttpStatusCode expectedStatusCode, IJSendResponse response, ApiController controller) { // Exercise system var result = new JSendResult<IJSendResponse>(expectedStatusCode, response, controller); // Verify outcome result.StatusCode.Should().Be(expectedStatusCode); }