39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using System.Reflection;
|
|
using JobTrackerApi.Controllers;
|
|
using JobTrackerApi.Services;
|
|
using Xunit;
|
|
|
|
namespace JobTrackerApi.Tests;
|
|
|
|
public sealed class OwnershipGuardTests
|
|
{
|
|
[Fact]
|
|
public void Attachments_controller_has_owned_attachment_lookup_helper()
|
|
{
|
|
var method = typeof(AttachmentsController).GetMethod("FindOwnedAttachmentAsync", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
Assert.NotNull(method);
|
|
}
|
|
|
|
[Fact]
|
|
public void Correspondence_controller_has_owned_message_lookup_helper()
|
|
{
|
|
var method = typeof(CorrespondenceController).GetMethod("FindOwnedMessageAsync", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
Assert.NotNull(method);
|
|
}
|
|
|
|
[Fact]
|
|
public void Summarizer_service_uses_sha256_cache_key_builder()
|
|
{
|
|
var method = typeof(SummarizerService).GetMethod("BuildCacheKey", BindingFlags.NonPublic | BindingFlags.Static);
|
|
Assert.NotNull(method);
|
|
|
|
var first = (string)method!.Invoke(null, new object[] { "example text", 150, 30 })!;
|
|
var second = (string)method.Invoke(null, new object[] { "example text", 150, 30 })!;
|
|
var different = (string)method.Invoke(null, new object[] { "different text", 150, 30 })!;
|
|
|
|
Assert.Equal(first, second);
|
|
Assert.StartsWith("summ:", first);
|
|
Assert.NotEqual(first, different);
|
|
}
|
|
}
|