Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
BrammyS committed Sep 30, 2021
2 parents 2e7bfd2 + 220abc3 commit f76c958
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 50 deletions.
2 changes: 1 addition & 1 deletion samples/RoleManager/Pipelines/PerformancePipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task<Result<IDiscordInteractionResponse>> HandleAsync(ISlashCommand

sw.Stop();

_logger.Log(sw.ElapsedMilliseconds > 500 ? LogLevel.Warning : LogLevel.Information, "Command {Name} ran for {Time}ms.", context.MethodName, sw.ElapsedMilliseconds.ToString());
_logger.Log(sw.ElapsedMilliseconds > 500 ? LogLevel.Warning : LogLevel.Information, "Command {Name} ran for {Time}ms", context.MethodName, sw.ElapsedMilliseconds.ToString());
return result;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public async Task<Result<IDiscordInteractionResponse>> ExecuteComponentInteracti
if (componentInfo.ComponentMethod.Invoke(instance, null) is not Task<Result<IDiscordInteractionResponse>> task)
{
var errorMessage = $"Failed to cast {componentInfo.ComponentMethod.Name} to Task<Result<IDiscordInteractionResponse>>";
// ReSharper disable once TemplateIsNotCompileTimeConstantProblem
_logger.LogWarning(errorMessage);
return Result<IDiscordInteractionResponse>.FromError(default, new ErrorResult(errorMessage));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Color_Chan.Discord.Core.Common.Models.Interaction;
using Color_Chan.Discord.Core.Common.Models.Message;
using Color_Chan.Discord.Rest.Models.Guild;
using Color_Chan.Discord.Rest.Models.Message;

namespace Color_Chan.Discord.Rest.Models.Interaction
{
Expand All @@ -21,6 +22,7 @@ public DiscordInteraction(DiscordInteractionData data)
if (data.User is not null) User = new DiscordUser(data.User);
Token = data.Token;
Versions = data.Versions;
if (data.Message is not null) Message = new DiscordMessage(data.Message);
}

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3"/>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0"/>
<PackageReference Include="Moq" Version="4.16.1"/>
<PackageReference Include="nunit" Version="3.13.2"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0"/>
<PackageReference Include="FluentAssertions" Version="6.1.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Color-Chan.Discord.Caching\Color-Chan.Discord.Caching.csproj"/>
<ProjectReference Include="..\..\src\Color-Chan.Discord.Caching\Color-Chan.Discord.Caching.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3"/>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0"/>
<PackageReference Include="Moq" Version="4.16.1"/>
<PackageReference Include="nunit" Version="3.13.2"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0"/>
<PackageReference Include="FluentAssertions" Version="6.1.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Color-Chan.Discord\Color-Chan.Discord.csproj"/>
<ProjectReference Include="..\mockCommandAssemblies\Color-Chan.Discord.Commands.Tests.Invalid\Color-Chan.Discord.Commands.Tests.Invalid.csproj"/>
<ProjectReference Include="..\mockCommandAssemblies\Color-Chan.Discord.Commands.Tests.Valid\Color-Chan.Discord.Commands.Tests.Valid.csproj"/>
<ProjectReference Include="..\..\src\Color-Chan.Discord\Color-Chan.Discord.csproj" />
<ProjectReference Include="..\mockCommandAssemblies\Color-Chan.Discord.Commands.Tests.Invalid\Color-Chan.Discord.Commands.Tests.Invalid.csproj" />
<ProjectReference Include="..\mockCommandAssemblies\Color-Chan.Discord.Commands.Tests.Valid\Color-Chan.Discord.Commands.Tests.Valid.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3"/>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0"/>
<PackageReference Include="Moq" Version="4.16.1"/>
<PackageReference Include="nunit" Version="3.13.2"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0"/>
<PackageReference Include="FluentAssertions" Version="6.1.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
</ItemGroup>

<ItemGroup>
<Folder Include="Common"/>
<Folder Include="Common" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="TestJson\**\*"/>
<EmbeddedResource Include="TestJson\**\*" />
<Content Include="TestJson\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Color-Chan.Discord.Core\Color-Chan.Discord.Core.csproj"/>
<ProjectReference Include="..\..\src\Color-Chan.Discord.Core\Color-Chan.Discord.Core.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void Should_parse_permissions_string(string permissionString, DiscordPerm
var permission = permissionString.ConvertToGuildPermission();

// Assert
expectedPermission.Should().BeEquivalentTo(permission);
expectedPermission.Should().Be(permission);
}

[TestCase("1409286155", DiscordPermission.Administrator |
Expand Down Expand Up @@ -101,7 +101,7 @@ public void Should_parse_permissions_span(string permissionString, DiscordPermis
var permission = span.ConvertToGuildPermission();

// Assert
expectedPermission.Should().BeEquivalentTo(permission);
expectedPermission.Should().Be(permission);
}
}
}
4 changes: 2 additions & 2 deletions tests/Color-Chan.Discord.Core.Tests/JsonTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public async Task Should_serialize_and_deserialize(string filepath)
var serialized = await JsonDocument.ParseAsync(stream);
var original = await JsonDocument.ParseAsync(testJson);

var serializedString = serialized.RootElement.GetRawText();
var originalString = original.RootElement.GetRawText();
var serializedString = serialized.RootElement.GetRawText().Replace("\r", "").Replace("\n", "");
var originalString = original.RootElement.GetRawText().Replace("\r", "").Replace("\n", "");

serializedString.Should().BeEquivalentTo(originalString);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3"/>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0"/>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0"/>
<PackageReference Include="Moq" Version="4.16.1"/>
<PackageReference Include="nunit" Version="3.13.2"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0"/>
<PackageReference Include="FluentAssertions" Version="6.1.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Color-Chan.Discord.Rest\Color-Chan.Discord.Rest.csproj"/>
<ProjectReference Include="..\..\src\Color-Chan.Discord.Rest\Color-Chan.Discord.Rest.csproj" />
</ItemGroup>

</Project>
16 changes: 8 additions & 8 deletions tests/Color-Chan.Discord.Tests/Color-Chan.Discord.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3"/>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0"/>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0"/>
<PackageReference Include="Moq" Version="4.16.1"/>
<PackageReference Include="nunit" Version="3.13.2"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0"/>
<PackageReference Include="FluentAssertions" Version="6.1.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Color-Chan.Discord\Color-Chan.Discord.csproj"/>
<ProjectReference Include="..\..\src\Color-Chan.Discord\Color-Chan.Discord.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.0"/>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Color-Chan.Discord\Color-Chan.Discord.csproj"/>
<ProjectReference Include="..\..\..\src\Color-Chan.Discord\Color-Chan.Discord.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.0"/>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Color-Chan.Discord.Core\Color-Chan.Discord.Core.csproj"/>
<ProjectReference Include="..\..\..\src\Color-Chan.Discord.Core\Color-Chan.Discord.Core.csproj" />
</ItemGroup>

</Project>

0 comments on commit f76c958

Please sign in to comment.