-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for missing fields and classes
- Loading branch information
Showing
6 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
Backend/Remora.Discord.API/API/Objects/Messages/MessageSnapshot.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// MessageSnapshot.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <[email protected]> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using JetBrains.Annotations; | ||
using Remora.Discord.API.Abstractions.Objects; | ||
|
||
namespace Remora.Discord.API.Objects; | ||
|
||
/// <inheritdoc cref="IMessageSnapshot" /> | ||
[PublicAPI] | ||
public record MessageSnapshot(IPartialMessage Message) : IMessageSnapshot; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
Tests/Remora.Discord.API.Tests/API/Objects/Messages/MessageSnapshotTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// MessageSnapshotTests.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <[email protected]> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using Remora.Discord.API.Abstractions.Objects; | ||
using Remora.Discord.API.Tests.TestBases; | ||
|
||
namespace Remora.Discord.API.Tests.Objects; | ||
|
||
/// <inheritdoc /> | ||
public class MessageSnapshotTests : ObjectTestBase<IMessageSnapshot> | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="MessageSnapshotTests"/> class. | ||
/// </summary> | ||
/// <param name="fixture">The test fixture.</param> | ||
public MessageSnapshotTests(JsonBackedTypeTestFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
Tests/Remora.Discord.Tests/Samples/Objects/MESSAGE_REFERENCE/MESSAGE_REFERENCE.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Tests/Remora.Discord.Tests/Samples/Objects/MESSAGE_SNAPSHOT/MESSAGE_SNAPSHOT.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"message": { | ||
"content": "none", | ||
"timestamp": "1970-01-01T00:00:00.000000+00:00", | ||
"edited_timestamp": "1970-01-01T00:00:00.000000+00:00", | ||
"mentions": [ | ||
{ | ||
"username": "none", | ||
"discriminator": "9999", | ||
"id": "999999999999999999", | ||
"avatar": "68b329da9893e34099c7d8ad5cb9c940" | ||
} | ||
], | ||
"mention_roles": [ | ||
"999999999999999999" | ||
], | ||
"attachments": [ | ||
{ | ||
"id": "999999999999999999", | ||
"filename": "file.png", | ||
"size": 0, | ||
"url": "https://www.example.org", | ||
"proxy_url": "https://www.example.org" | ||
} | ||
], | ||
"embeds": [ | ||
{} | ||
], | ||
"type": 1, | ||
"flags": 1, | ||
"components": [ | ||
{ | ||
"type": 1, | ||
"components": [] | ||
} | ||
], | ||
"sticker_items": [ | ||
{ | ||
"id": "999999999999999999", | ||
"name": "none", | ||
"format_type": 1 | ||
} | ||
] | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
Tests/Remora.Discord.Tests/Samples/Objects/MESSAGE_SNAPSHOT/MESSAGE_SNAPSHOT.optionals.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"message": { | ||
"content": "none", | ||
"timestamp": "1970-01-01T00:00:00.000000+00:00", | ||
"edited_timestamp": "1970-01-01T00:00:00.000000+00:00", | ||
"mentions": [ | ||
{ | ||
"username": "none", | ||
"discriminator": "9999", | ||
"id": "999999999999999999", | ||
"avatar": "68b329da9893e34099c7d8ad5cb9c940" | ||
} | ||
], | ||
"mention_roles": [ | ||
"999999999999999999" | ||
], | ||
"attachments": [ | ||
{ | ||
"id": "999999999999999999", | ||
"filename": "file.png", | ||
"size": 0, | ||
"url": "https://www.example.org", | ||
"proxy_url": "https://www.example.org" | ||
} | ||
], | ||
"embeds": [ | ||
{} | ||
], | ||
"type": 1, | ||
"flags": 1, | ||
"components": [ | ||
{ | ||
"type": 1, | ||
"components": [] | ||
} | ||
], | ||
"sticker_items": [ | ||
{ | ||
"id": "999999999999999999", | ||
"name": "none", | ||
"format_type": 1 | ||
} | ||
] | ||
} | ||
} |