Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release
- BuildBot.Json.Tests: new test project covering BuildBot.Json at 100% line and branch coverage
- BuildBot.ServiceModel.Tests: Added test coverage for all types in BuildBot.ServiceModel
- BuildBot.Discord.Tests: Added unit tests to increase code coverage to 100%
- BotService null-guard branch coverage test
### Fixed
- Suppress known Scriban 6.2.0 vulnerabilities pending upgrade
- SnsMessage: Token property was never populated from the constructor argument
Expand Down
14 changes: 14 additions & 0 deletions src/BuildBot.Discord.Tests/Services/BotServiceTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using BuildBot.Discord.Models;
Expand Down Expand Up @@ -105,4 +106,17 @@ await bot.Received(1)
);
}
}

[Fact]
public void Constructor_ThrowsArgumentNullException_WhenBotIsNull()
{
ConstructorInfo? ctor = typeof(BotService).GetConstructor(
[typeof(IDiscordBot), typeof(IMessageChannel<BotMessage>), typeof(IMessageChannel<BotReleaseMessage>)]
);
Assert.NotNull(ctor);

TargetInvocationException ex = Assert.Throws<TargetInvocationException>(() => ctor.Invoke([null, null, null]));
ArgumentNullException ane = Assert.IsType<ArgumentNullException>(ex.InnerException);
Assert.Equal(expected: "bot", actual: ane.ParamName);
}
}
Loading