httpflow
httpflow copied to clipboard
Test case ReturnsTwoContributors() fails
Test function ReturnsTwoContributors()
fails.
- .NET SDK Version: 8.0
Steps to Reproduce:
- Download the repository.
- Run all the tests and will see
ReturnsTwoContributors()
is failing.
The error screenshot:
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 ---
Have you put a break point and se what has happened? So we can see the real reason of the internal error
I have provided error message itself.
@yogyogi
As shown and commented in the code, the database is InMemory and the query will not execute
@yogyogi
If you want the test to pass you can use the LINQ query instead of SQL raw query
@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.
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?