Skip to content

Commit 5a8f10b

Browse files
committed
Add ApiResponse to JsonBotSerializerContext (#1478)
1 parent 810ff70 commit 5a8f10b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Telegram.Bot/Serialization/JsonBotSerializerContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ namespace Telegram.Bot;
171171
[JsonSerializable(typeof(SetInlineGameScoreRequest))]
172172
[JsonSerializable(typeof(GetGameHighScoresRequest))]
173173
[JsonSerializable(typeof(GetInlineGameHighScoresRequest))]
174-
[JsonSerializable(typeof(ApiResponse))]
174+
[JsonSerializable(typeof(Telegram.Bot.Exceptions.ApiResponse))]
175175
[JsonSerializable(typeof(ApiResponse<Update[]>))]
176176
[JsonSerializable(typeof(ApiResponse<bool>))]
177177
[JsonSerializable(typeof(ApiResponse<WebhookInfo>))]

test/Telegram.Bot.Tests.Integ/Sending Messages/HtmlMessageTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ It is <tg-spoiler>awesome!!</tg-spoiler>
3131
</row>
3232
</keyboard>
3333
""");
34-
Assert.Equal(1, msgs.Length);
34+
Assert.Single(msgs);
3535
Assert.Equal(MessageType.Text, msgs[0].Type);
3636
}
3737

@@ -43,7 +43,7 @@ public async Task Send_Photo()
4343
<img src="https://cdn.pixabay.com/photo/2017/04/11/21/34/giraffe-2222908_640.jpg">
4444
<u>Giraffe</u>
4545
""");
46-
Assert.Equal(1, msgs.Length);
46+
Assert.Single(msgs);
4747
Assert.Equal(MessageType.Photo, msgs[0].Type);
4848
classFixture.Entity = msgs[0];
4949
}
@@ -56,7 +56,7 @@ public async Task Send_Photo_FileId_CaptionAbove()
5656
<b><i>Giraffe</i></b>
5757
<img src="{classFixture.Entity.Photo[^1].FileId}">
5858
""");
59-
Assert.Equal(1, msgs.Length);
59+
Assert.Single(msgs);
6060
Assert.Equal(MessageType.Photo, msgs[0].Type);
6161
}
6262

@@ -67,7 +67,7 @@ public async Task Send_Video_Spoiler()
6767
var msgs = await BotClient.SendHtml(Fixture.SupergroupChat.Id, """
6868
<video src="https://cdn.pixabay.com/video/2017/07/19/10737-226624883_medium.mp4" spoiler>
6969
""");
70-
Assert.Equal(1, msgs.Length);
70+
Assert.Single(msgs);
7171
Assert.Equal(MessageType.Video, msgs[0].Type);
7272
Assert.Null(msgs[0].Caption);
7373
Assert.True(msgs[0].HasMediaSpoiler);
@@ -169,7 +169,7 @@ public async Task Send_Custom_Preview()
169169
Hello, world
170170
<preview url="https://github.com/TelegramBots/book" small above>
171171
""");
172-
Assert.Equal(1, msgs.Length);
172+
Assert.Single(msgs);
173173
Assert.Equal(MessageType.Text, msgs[0].Type);
174174
Asserts.JsonEquals(new LinkPreviewOptions() { Url = "https://github.com/TelegramBots/book", PreferSmallMedia = true, ShowAboveText = true }, msgs[0].LinkPreviewOptions);
175175
}

0 commit comments

Comments
 (0)