Commit Graph

22 Commits

Author SHA1 Message Date
Grzegorz Dziadkiewicz 04c9a9a0de Update MiscellaneousClient to ApiClient approach and add pagination support to GetAllLicenses. (#1716)
Co-authored-by: Brendan Forster <brendan@github.com>
2020-02-25 18:48:00 -04:00
Brendan Forster 45bc5eced7 autofix tests based on feedback from xunit analyzers (#1997) 2019-09-16 19:46:40 -03:00
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
Ryan Gribble a489092f62 Add Importer property to Meta response model
Implement unit test for GetMetadata() call
Flesh out integration test to check all returned Meta fields
-> Found and fixed a bug where the existing `GitHubServicesSHA` field was not deserialised properly
2016-04-03 21:58:45 +10:00
Brendan Forster 80719c0033 aaaand format the code 2015-11-04 13:38:51 -08:00
Haacked 7f901c47e8 Implement the Meta endpoint
See https://developer.github.com/v3/meta/ for more information about
this endpoint.
2015-09-12 16:14:13 -07:00
Mark Taylor 4d9cc4ff09 Additional changes following review 2015-07-27 14:07:15 +01:00
Mark Taylor e092a109ea Additional changes to support rate_limit API call 2015-07-26 22:03:19 +01:00
Mark Taylor d88f180cd6 Added GetRateLimits to MiscellaneousClient 2015-07-24 21:30:25 +01:00
Henrik Andersson 189ae42c3a Update tests 2015-03-24 00:12:54 +10:00
Haacked 0d096dfc92 Implement method to retrieve a single license 2015-03-17 17:50:50 -07:00
Haacked 0e35999811 Implement api to get list of licenses 2015-03-17 17:50:22 -07:00
Haacked f6abb9b0d3 Implement Methods to retrieve gitignore 2015-03-17 10:29:13 -07:00
Brendan Forster 60e3c9a675 tidy up some using statements 2015-01-04 10:03:47 +09:30
Brendan Forster 28e8372922 extract helper method for setting up GitHubClient 2015-01-04 10:03:45 +09:30
Brendan Forster 87c579c33f lol tests 2014-12-10 21:22:16 +10:30
Brendan Forster feb436ac84 Merge branch 'master' into release-0.6
Conflicts:
	Octokit.Tests.Integration/Clients/MiscellaneousClientTests.cs
	build.cmd
	build.fsx
2014-12-10 20:15:06 +10:30
Haacked 24f6d4dd87 Fix Markdown test
The markdown api adds a trailing newline if there isn't already one. It
also converts \r\n to \n.
2014-11-07 14:50:08 -08:00
Brendan Forster d8740ea854 line endings are the worst 2014-10-14 10:15:59 -02:00
Tim Sneed 3909498437 Internalize ProductHeaderValue
What Haacked, PaulBetts, and Shiftkey suggested
2014-02-28 06:33:44 -06:00
Brendan Forster 446ea0e89a stripped out some unnecessary namespaces for tests 2013-12-29 10:17:51 +10:30
Brendan Forster 6cba426813 let's make the folder structure consistent 2013-11-27 10:17:16 -08:00