chore: begin porting code from playground

This commit is contained in:
Stevan Freeborn
2025-05-07 23:54:46 -05:00
parent 30dbba37be
commit 3f4ab165ce
19 changed files with 230 additions and 24 deletions
@@ -0,0 +1,37 @@
namespace StevesBot.Worker.Tests.Unit;
public class DiscordClientExceptionTests
{
[Fact]
public void Constructor_WhenCalledWithoutParameters_ItShouldCreateInstance()
{
var exception = new DiscordClientException();
exception.Should().NotBeNull();
exception.Should().BeOfType<DiscordClientException>();
}
[Fact]
public void Constructor_WhenCalledWithMessage_ItShouldCreateInstance()
{
var message = "Test message";
var exception = new DiscordClientException(message);
exception.Should().NotBeNull();
exception.Should().BeOfType<DiscordClientException>();
exception.Message.Should().Be(message);
}
[Fact]
public void Constructor_WhenCalledWithMessageAndInnerException_ItShouldCreateInstance()
{
var message = "Test message";
var innerException = new Exception("Inner exception");
var exception = new DiscordClientException(message, innerException);
exception.Should().NotBeNull();
exception.Should().BeOfType<DiscordClientException>();
exception.Message.Should().Be(message);
exception.InnerException.Should().Be(innerException);
}
}
@@ -0,0 +1,37 @@
namespace StevesBot.Worker.Tests.Unit;
public class DiscordClientOptionsTests
{
[Fact]
public void Constructor_WhenCalledWithoutParameters_ItShouldCreateInstance()
{
var options = new DiscordClientOptions();
options.Should().NotBeNull();
options.Should().BeOfType<DiscordClientOptions>();
options.ApiUrl.Should().Be(string.Empty);
options.AppToken.Should().Be(string.Empty);
options.Intents.Should().Be(0);
}
[Fact]
public void Constructor_WhenCalledWithParameters_ItShouldCreateInstance()
{
var apiUrl = "https://api.example.com";
var appToken = "test-token";
var intents = 123;
var options = new DiscordClientOptions
{
ApiUrl = apiUrl,
AppToken = appToken,
Intents = intents
};
options.Should().NotBeNull();
options.Should().BeOfType<DiscordClientOptions>();
options.ApiUrl.Should().Be(apiUrl);
options.AppToken.Should().Be(appToken);
options.Intents.Should().Be(intents);
}
}