public void Should_Throw_On_Null_Settings_Parameter() { //Given ICakeContext context = _Context; HttpSettings settings = null; string address = RootAddress; string httpMethod = "POST"; //When var record = Record.Exception(() => HttpClientAliases.HttpSend(context, address, httpMethod, settings)); //Then CakeAssert.IsArgumentNullException(record, nameof(settings)); }
public void Should_Post_And_Return_Json_Result() { //Given ICakeContext context = _Context; HttpSettings settings = new HttpSettings(); string address = $"{ RootAddress }/posts"; string httpMethod = "POST"; settings.SetRequestBody("{ \"title\": \"foo\", \"body\": \"bar\", \"userId\": 1}"); //When var actual = HttpClientAliases.HttpSend(context, address, httpMethod, settings); //Then var expected = "{\n \"id\": 101\n}"; Assert.NotNull(actual); Assert.Equal(expected, actual, ignoreCase: true, ignoreLineEndingDifferences: true, ignoreWhiteSpaceDifferences: true); }