-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCctvChoiceDriftTests.cs
More file actions
40 lines (36 loc) · 1.18 KB
/
Copy pathCctvChoiceDriftTests.cs
File metadata and controls
40 lines (36 loc) · 1.18 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
35
36
37
38
39
40
using System.Reflection;
using Discord.Interactions;
using RustPlusBot.Features.Commands.Modules;
using RustPlusBot.Features.ItemData;
namespace RustPlusBot.Features.Commands.Tests.Modules;
public sealed class CctvChoiceDriftTests
{
private static IReadOnlyList<string> ChoiceValues()
{
var parameter = typeof(ItemCommandModule)
.GetMethod(nameof(ItemCommandModule.CctvAsync))!
.GetParameters()[0];
return
[
.. parameter.GetCustomAttributes<ChoiceAttribute>()
.Select(c => (string)c.Value!)
];
}
[Fact]
public void EveryChoiceResolvesToAMonument()
{
var db = new EmbeddedItemDatabase();
foreach (var value in ChoiceValues())
{
Assert.IsType<RustPlusBot.Features.ItemData.Lookup.CctvMatch.Found>(db.ResolveCctv(value));
}
}
[Fact]
public void ChoiceSetEqualsMonumentSet()
{
var db = new EmbeddedItemDatabase();
var monuments = db.CctvMonuments.Select(m => m.Name).ToHashSet(StringComparer.Ordinal);
var choices = ChoiceValues().ToHashSet(StringComparer.Ordinal);
Assert.Equal(monuments, choices);
}
}