-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathEnumToEnumValueListConverterTests.cs
46 lines (39 loc) · 1.42 KB
/
EnumToEnumValueListConverterTests.cs
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
41
42
43
44
45
46
#nullable enable
using System.Diagnostics.CodeAnalysis;
using GovUk.Education.ExploreEducationStatistics.Common.Converters;
using GovUk.Education.ExploreEducationStatistics.Common.Database;
using Xunit;
namespace GovUk.Education.ExploreEducationStatistics.Common.Tests.Converters;
public abstract class EnumToEnumValueListConverterTests
{
[SuppressMessage("ReSharper", "UnusedMember.Local")]
private enum Numbers
{
[EnumLabelValue("1", "Value-1")] One,
[EnumLabelValue("2", "Value-2")] Two,
[EnumLabelValue("3", "Value-3")] Three
}
private readonly EnumToEnumValueListConverter<Numbers> _converter = new();
public class ConvertToProviderTests : EnumToEnumValueListConverterTests
{
[Fact]
public void Success()
{
var converted = _converter.ConvertToProviderTyped([Numbers.Two, Numbers.Three]);
Assert.Equal(2, converted.Count);
Assert.Equal("Value-2", converted[0]);
Assert.Equal("Value-3", converted[1]);
}
}
public class ConvertFromProviderTests : EnumToEnumValueListConverterTests
{
[Fact]
public void Success()
{
var converted = _converter.ConvertFromProviderTyped(["Value-1", "Value-2"]);
Assert.Equal(2, converted.Count);
Assert.Equal(Numbers.One, converted[0]);
Assert.Equal(Numbers.Two, converted[1]);
}
}
}