public void Given_NullServiceOptions_InvokeAsync_ShouldThrow_Exception() { var settings = this._fixture.ArrangeAppSettings(); var client = this._fixture.ArrangeHttpClient(); var service = new AglPayloadLoadingService(settings.Object, client); Func <Task> func = async() => await service.InvokeAsync <ServiceOptionsBase>(null).ConfigureAwait(false); func.ShouldThrow <ArgumentNullException>(); }
public void Given_ErrorResponse_InvokeAsync_ShouldThrow_Exception(HttpStatusCode statusCode, string phrase) { var settings = this._fixture.ArrangeAppSettings(); var client = this._fixture.ArrangeHttpClient(statusCode, phrase); var options = new AglPayloadLoadingServiceOptions(); var service = new AglPayloadLoadingService(settings.Object, client); Func <Task> func = async() => await service.InvokeAsync(options).ConfigureAwait(false); func.ShouldThrow <HttpException>(); }
public async void Given_Response_InvokeAsync_ShouldReturn_Result(HttpStatusCode statusCode, string phrase) { var settings = this._fixture.ArrangeAppSettings(); var content = this._fixture.Fixture.CreateMany <Person>().ToList(); var client = this._fixture.ArrangeHttpClient(statusCode, phrase, content); var options = new AglPayloadLoadingServiceOptions(); var service = new AglPayloadLoadingService(settings.Object, client); await service.InvokeAsync(options).ConfigureAwait(false); options.People.Should().HaveCount(content.Count); options.IsInvoked.Should().BeTrue(); }