Commit Graph

16 Commits

Author SHA1 Message Date
Kristian Hellang
5ee4d64046 Add StringEnum to handle unknown enum values returned from API (#1595)
* Added StringEnum<TEnum>

* Added tests

* Make sure the serializer can work with StringEnum

* Use StringEnum for EventInfo.Event

* Add convention test to assert that all Response models use StringEnum<> to wrap enum properties

* Add Stringnum<> to all response types failing convention test

* Handle StringEnum to Enum conversion when Issue response model populates IssueUpdate request model

* Fix unit test

* Refactor SimpleJsonSerializer to expose the DeserializeEnum strategy so it can be used in StringEnum class

* Need to expose/use SerializeEnum functionality too, so we use the correct string representation of enum values that have custom properties (eg ReactionType Plus1 to "+1")

* fix unit tests, since the string is now the "correct" upstream api value

* Add a couple of tests for the Enum serialize/deserialize when underscores, hyphens and custom property attributes are present

* Compare parsed values for equality

* add convention test to ensure enum members all have Parameter property set

* update test to cover implicit conversions too

* this test should work but fails at the moment due to magic hyphen removal in deserializer causing a one way trip from utf-8 to EncodingType.Utf8 with no way to get back

* (unsuccesfully) expand event info test to try to catch more cases of unknown event types

* fix broken integration test while im here

* Fixed build errors after .NET Core merge

* Value -> StringValue, ParsedValue -> Value

* Don't allow StringValue to be null

* Ignore enums not used in request/response models

* Added ParameterAttribute to almost all enum values

* Ignore Language enum

* Fix failing tests

* Fix milestone sort parameter and tests

* whitespace

* fix milestone unit tests

* Fix StringEnum.Equals ... This could've been embarrassing!

* Change SimpleJsonSerializer Enum handling to only use `[Parameter()]` attributes (no more magic removal of hyphen/underscores from strings)

* Tidy up this integration test while im here

* Only test request/response enums in convention test

* Keep skipping Language

* Remove unused method

* Remove excluded enum types

* Removed unnecessary ParameterAttributes

* Remove unused enum

* Add StringEnum test for string-comparison of two invalid values

* Bring back IssueCommentSort and use it in IssueCommentRequest

This reverts commit 38a4a291d1476ef8c992fe0f76956974b6f32a49.

* Use assembly instead of namespace for Octokit check

* Add failing test to reproduce the issue where only the first enum paramter/value was added to the cache

* Fix deserializer enum cache to include all enum members rather than only the first member encountered

* Use a static SimpleJsonSerializer in StringEnum

* Remove serializer instance in StringEnum

* Add some documentation on StringEnum<TEnum>

* Fix parameter value to resolve failing integration test
2017-06-25 19:29:57 +10:00
aedampir@gmail.com
8e7bfe63c4 RepositoryRequest fixes 2016-03-29 17:41:57 +07:00
Phil Haack
43e78584e0 Merge pull request #1219 from dampir/remove-redundant-commas
Remove redundant commas
2016-03-25 09:07:45 -07:00
aedampir@gmail.com
695cf8e75b Unused "using" directives were removed in whole solution. 2016-03-25 13:38:07 +07:00
aedampir@gmail.com
1cd419ef75 Redundant commas in enum declaration were removed. 2016-03-24 23:09:11 +07:00
Alex P
7866f3cbd1 Update DebuggerDisplay in RepositoryRequest 2016-03-08 20:04:24 +02:00
Alex P
f50ccf77b1 #1107 Make RepositoryRequest properties nullable and add tests 2016-03-08 15:57:55 +02:00
Alex P
0188238cb5 #1107 Do no set visibility and affiliation value to avoid mixing with type 2016-03-07 11:55:16 +02:00
Sarmad
2366c998a2 added unit tests for the new-parameters-on-ListYourRepository 2016-02-10 04:29:43 +05:00
Sarmad
d7cb5620fe fixed typo and improved formatting in comments 2016-02-08 16:22:41 +05:00
Sarmad
30553d34e3 fixed some typo and formatting issues 2016-02-07 21:04:17 +05:00
Sarmad
b4d86d07dc added new parameters to RepositoryRequest.cs 2016-02-07 19:15:31 +05:00
Mordechai Zuber
44304ca70b use string per recommended style 2015-12-16 21:23:36 +02:00
Haacked
862bf6a5d3 Add a bunch of doc comments
We get a lot of build output because of missing XML comments that we
ignore. I'd like to stop ignoring them. To do that, we need to doc the
💩 out of everything.
2015-09-27 17:10:39 -07:00
Brendan Forster
f2a51b63f4 added some DebuggerDisplay 2015-03-06 09:44:49 +09:30
Brendan Forster
ee4f07c475 add new endpoint for filtering user's repositories 2015-03-06 09:44:48 +09:30