Cardboard-Net / Cardboard.Net

a C# port of cardboard
MIT License
2 stars 3 forks source link

Create unit tests #17

Open puppygirlhornypost opened 2 months ago

puppygirlhornypost commented 2 months ago

Description

https://github.com/discord-net/Discord.Net/tree/dev/test

I'd like to make deserialization/serialization tests for the various DTOs using payloads from the API itself. Sensitive data such as ids replaced with placeholder values. It seems like Discord.NET does mock tests for some of the stuff, and unit testing for things like their embedbuilder. I'd like to replicate that for pollbuilder (to ensure the constraints work). Having a library of real responses from the API will help us for numerous reasons.

1) The example responses aren't complete (and lack a lot of areas, such as the achievement objects in api/i for instance). 2) Having a complete collection of objects such as audit log (and the various types) is how I end up making a majority of the classes and seeing what similarities each object has in relation to each other (good example: AdminMeta and Meta) 3) It allows people who do not have an instance to query or play around with see what kind of responses they can expect to get. Especially when it comes to the admin endpoints. Reading the source code is not the best way either since misskey.io uses a custom fork of misskey for instance.

puppygirlhornypost commented 2 months ago

I really am developing a taste for gRPC based docs... https://google.aip.dev/127 and I wonder how hard it would be to make a gRPC based test server for some of the more complicated matters. https://grpc.io/docs/languages/csharp/. An example comes to mind of testing things like UserRelation in relation (lol) to executing FollowAsync(). Idk, lots to play around with.