tests: begin moving tests to lib test project
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
namespace StevesBot.Library.Tests.Unit;
|
||||||
|
|
||||||
|
public class ServicesExtensionsTests
|
||||||
|
{
|
||||||
|
private readonly DiscordClientOptions _discordClientOptions = new()
|
||||||
|
{
|
||||||
|
ApiUrl = "https://test.com",
|
||||||
|
AppToken = "test_token",
|
||||||
|
};
|
||||||
|
private readonly ServiceCollection _services = new();
|
||||||
|
|
||||||
|
public ServicesExtensionsTests()
|
||||||
|
{
|
||||||
|
_services.AddSingleton(_discordClientOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void AddDiscordRestClient_WhenCalled_ItShouldAddDiscordRestClient()
|
||||||
|
{
|
||||||
|
_services.AddDiscordRestClient();
|
||||||
|
|
||||||
|
var act = () => _services
|
||||||
|
.BuildServiceProvider()
|
||||||
|
.GetRequiredService<IDiscordRestClient>();
|
||||||
|
|
||||||
|
act.Should().NotThrow();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
global using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
global using StevesBot.Library.Discord;
|
||||||
|
global using StevesBot.Library.Discord.Common;
|
||||||
|
global using StevesBot.Library.Discord.Rest;
|
||||||
@@ -24,18 +24,6 @@ public class ExtensionsTests
|
|||||||
_services.AddSingleton(_mockScopeFactory.Object);
|
_services.AddSingleton(_mockScopeFactory.Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void AddDiscordRestClient_WhenCalled_ItShouldAddDiscordRestClient()
|
|
||||||
{
|
|
||||||
_services.AddDiscordRestClient();
|
|
||||||
|
|
||||||
var act = () => _services
|
|
||||||
.BuildServiceProvider()
|
|
||||||
.GetRequiredService<IDiscordRestClient>();
|
|
||||||
|
|
||||||
act.Should().NotThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void AddDiscordGatewayClient_WhenCalled_ItShouldAddDiscordGatewayClient()
|
public void AddDiscordGatewayClient_WhenCalled_ItShouldAddDiscordGatewayClient()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user