httpflow icon indicating copy to clipboard operation
httpflow copied to clipboard

Test case ReturnsTwoContributors() fails

Open yogyogi opened this issue 1 year ago • 6 comments

Test function ReturnsTwoContributors() fails.

  • .NET SDK Version: 8.0

Steps to Reproduce:

  1. Download the repository.
  2. Run all the tests and will see ReturnsTwoContributors() is failing.

The error screenshot:

test-error

Error Message:

Message: 
System.Net.Http.HttpRequestException : Response status code does not indicate success: 500 (Internal Server Error).

Stack Trace: 
HttpResponseMessage.EnsureSuccessStatusCode()
HttpClientGetExtensionMethods.GetAndDeserializeAsync[T](HttpClient client, String requestUri, ITestOutputHelper output)
ContributorList.ReturnsTwoContributors() line 16
--- End of stack trace from previous location ---

yogyogi avatar Feb 14 '24 17:02 yogyogi

Have you put a break point and se what has happened? So we can see the real reason of the internal error

ParsaMehdipour avatar Feb 15 '24 15:02 ParsaMehdipour

I have provided error message itself.

yogyogi avatar Feb 15 '24 16:02 yogyogi

@yogyogi

As shown and commented in the code, the database is InMemory and the query will not execute

image

ParsaMehdipour avatar Feb 15 '24 22:02 ParsaMehdipour

@yogyogi

If you want the test to pass you can use the LINQ query instead of SQL raw query

ParsaMehdipour avatar Feb 15 '24 22:02 ParsaMehdipour

@ParsaMehdipour I think all test should pass beforehand. People should not have to do manual settings on the fresh download copy. I have also seen the previous version of this repo where all test were passing so this is probably a bug that needs to be corrected.

yogyogi avatar Feb 16 '24 04:02 yogyogi

The issue appears to be two things. The column name needs to be aliased to PhoneNumber (to work with ContributorDTO) and NULL values need to be set to an empty string since PhoneNumber on the ContributorDTO is string and not string?. Updating the SQL to the following allows the test to pass (at least for sqlite which is the current default I believe):

SELECT Id, Name, COALESCE(PhoneNumber_Number, '') AS PhoneNumber FROM Contributors

I'll submit a PR for the change if no one has any objections?

mickymcq avatar Feb 19 '24 18:02 mickymcq