From 1306a7befbd2656bd064d734ea19e346ce84aac0 Mon Sep 17 00:00:00 2001 From: d4n3436 Date: Thu, 28 Dec 2023 14:02:11 -0500 Subject: [PATCH] Fix tests --- .../Converters/MicrosoftVoiceConverterTests.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/Fergun.Tests/Converters/MicrosoftVoiceConverterTests.cs b/tests/Fergun.Tests/Converters/MicrosoftVoiceConverterTests.cs index a99d058..a29d54b 100644 --- a/tests/Fergun.Tests/Converters/MicrosoftVoiceConverterTests.cs +++ b/tests/Fergun.Tests/Converters/MicrosoftVoiceConverterTests.cs @@ -1,7 +1,6 @@ using Bogus; using GTranslate.Translators; using Moq; -using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Net; @@ -11,13 +10,13 @@ using GTranslate; using Moq.Protected; using Xunit; -using System.Text; using Microsoft.Extensions.DependencyInjection; using Discord; using Fergun.Converters; using System; using Bogus.DataSets; using Discord.Interactions; +using System.Text; namespace Fergun.Tests.Converters; @@ -35,7 +34,7 @@ public void MicrosoftVoiceConverter_GetDiscordType_Returns_String() [Theory] [MemberData(nameof(GetMicrosoftVoiceTestData))] - public async Task MicrosoftVoiceConverter_ReadAsync_Retuns_Successful_Result(MicrosoftVoice voice, bool isDefault) + public async Task MicrosoftVoiceConverter_ReadAsync_Returns_Successful_Result(MicrosoftVoice voice, bool isDefault) { var microsoftTranslator = CreateMockedMicrosoftTranslator(() => { @@ -77,7 +76,7 @@ public async Task MicrosoftVoiceConverter_ReadAsync_Retuns_Successful_Result(Mic [InlineData(null, "en")] [InlineData("", "es")] [InlineData("\u200b", "it")] - public async Task MicrosoftVoiceConverter_ReadAsync_Retuns_Unsuccessful_Result(string voice, string locale) + public async Task MicrosoftVoiceConverter_ReadAsync_Returns_Unsuccessful_Result(string? voice, string locale) { var microsoftTranslator = CreateMockedMicrosoftTranslator(() => Task.FromCanceled(CancellationToken.None)); var localizer = Utils.CreateMockedLocalizer(); @@ -96,7 +95,7 @@ public async Task MicrosoftVoiceConverter_ReadAsync_Retuns_Unsuccessful_Result(s contextMock.SetupGet(x => x.Interaction).Returns(() => interactionMock.Object); var optionMock = new Mock(); - optionMock.SetupGet(x => x.Value).Returns(() => voice); + optionMock.SetupGet(x => x.Value).Returns(() => voice!); var result = await converter.ReadAsync(contextMock.Object, optionMock.Object, services); @@ -122,7 +121,7 @@ private static MicrosoftTranslator CreateMockedMicrosoftTranslator(Func new(HttpStatusCode.OK) { Content = new ByteArrayContent(data) }; - public static IEnumerable GetMicrosoftVoiceTestData() + public static TheoryData GetMicrosoftVoiceTestData() { var faker = new Faker(); var fakeVoices = faker.MakeLazy(10, () => @@ -133,10 +132,11 @@ public static IEnumerable GetMicrosoftVoiceTestData() string genderStr = gender.ToString(); return new MicrosoftVoice(displayName, $"{locale}-{displayName}Neural", genderStr, locale); - }).Select(x => new object[] { x, false }); + }).Select(x => (x, false)); return MicrosoftTranslator.DefaultVoices.Values - .Select(x => new object[] { x, true }) - .Concat(fakeVoices); + .Select(x => (x, true)) + .Concat(fakeVoices) + .ToTheoryData(); } } \ No newline at end of file