-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiscordOwnerNotifierTests.cs
More file actions
34 lines (27 loc) · 1.08 KB
/
Copy pathDiscordOwnerNotifierTests.cs
File metadata and controls
34 lines (27 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using NSubstitute;
using RustPlusBot.Discord.Notifications;
using RustPlusBot.Features.Pairing.Notifications;
namespace RustPlusBot.Features.Pairing.Tests;
public sealed class DiscordOwnerNotifierTests
{
[Fact]
public async Task NotifyCredentialsExpired_DmsTheOwner()
{
var dm = Substitute.For<IUserDmSender>();
var notifier = new DiscordOwnerNotifier(dm);
await notifier.NotifyCredentialsExpiredAsync(10UL, 99UL);
await dm.Received(1).SendAsync(
99UL,
Arg.Is<string>(m => m!.Contains("Reconnect", StringComparison.Ordinal)),
Arg.Any<CancellationToken>());
}
[Fact]
public async Task NotifySetupChannelMissing_dms_owner_with_setup_instructions()
{
var dm = Substitute.For<IUserDmSender>();
var notifier = new DiscordOwnerNotifier(dm);
await notifier.NotifySetupChannelMissingAsync(10UL, 99UL, CancellationToken.None);
await dm.Received(1).SendAsync(99UL,
Arg.Is<string>(m => m!.Contains("/setup", StringComparison.Ordinal)), Arg.Any<CancellationToken>());
}
}