public void WhenApiResponseIsWhitespace_ThenParseErrorThrows() { var handler = new EcbJsonResponseHandler(); var parseAction = new Action(() => handler.ParseError(" ")); parseAction.Should().Throw <ArgumentNullException>().WithMessage("*apiResponse"); }
public void WhenApiResponseIsEmpty_ThenParseMethodThrows() { var handler = new EcbJsonResponseHandler(); var parseAction = new Action(() => handler.ParseResponse(string.Empty)); parseAction.Should().Throw <ArgumentNullException>().WithMessage("*apiResponse"); }
public void WhenApiResponseIsParsed_ExpectedErrorIsReturned() { var errorMessage = "Base 'A' is not supported."; var apiResponse = $"{{\"error\":\"{errorMessage}\"}}"; var handler = new EcbJsonResponseHandler(); var output = handler.ParseError(apiResponse); output.Should().Be(errorMessage); }
public void WhenApiResponseIsParsed_ExpectedOutputIsReturned() { var handler = new EcbJsonResponseHandler(); var output = handler.ParseResponse(_ApiResponse); output.BaseCurrency.Should().Be("EUR"); output.Date.Should().Be(new DateTime(2019, 2, 8)); output.Rates.Count.Should().Be(32); }