pawotter / mastodon-api-cs

The Mastodon API Client Library for C#
https://github.com/tootsuite/mastodon
MIT License
27 stars 4 forks source link

Running unit tests throwing Uri format exceptions #12

Closed toryalsip closed 7 years ago

toryalsip commented 7 years ago

Two tests are failing for me, AccountTest.DeserializeTest and StatusTest.DeserializeTest. This appears to be environmental, so I want to try and figure out why the behavior is so different.

Also @53ningen any information on your environment setup will be helpful for me. Thanks.

53ningen commented 7 years ago

Thank you for reporting the problem 🙏

~Both two test resources (get_account.json and get_status.json) contain emoji (). I think it may possibly causes test fails.~ (Oh... this is not url...)

I'll examine the details.

My environment is

53ningen commented 7 years ago

Could you show me the stack trace?

53ningen commented 7 years ago

@jbalsip Colud you try to run tests on code https://github.com/pawotter/mastodon-api-cs/pull/13 ?

toryalsip commented 7 years ago

Test results for a failing test here:

Test Name:  DeserializeTest
Test FullName:  Mastodon.API.Tests.AccountTest.DeserializeTest
Test Source:    C:\Users\jbals\Documents\GitHub\mastodon-api-cs\Mastodon.API.Tests\Entities\AccountTest.cs : line 12
Test Outcome:   Failed
Test Duration:  0:00:00.171

Result StackTrace:  
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at Mastodon.API.Tests.AccountTest.DeserializeTest() in C:\Users\jbals\Documents\GitHub\mastodon-api-cs\Mastodon.API.Tests\Entities\AccountTest.cs:line 15
Result Message: System.UriFormatException : Invalid URI: The format of the URI could not be determined.

I did try your changes and those tests do pass. I saw that you changed those types to just basic strings, which is OK I think. Looks to me like the difference is mostly due to how the different platforms handle that Uri data type. I may spend a little more time tonight looking at this to see if there's anything else. Thanks for investigating.

53ningen commented 7 years ago

@jbalsip Maybe this problem has been resolved by https://github.com/pawotter/mastodon-api-cs/pull/20. Please re-check the tests on HEAD of master branch.

toryalsip commented 7 years ago

All tests are passing for me, so that is good. Maybe if I get time later this weekend I do want to revisit the Uri object's behavior, at least for my own curiosity.