up
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Mirror Thin Bundle Sign & Verify / mirror-sign (push) Has been cancelled
api-governance / spectral-lint (push) Has been cancelled
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Mirror Thin Bundle Sign & Verify / mirror-sign (push) Has been cancelled
api-governance / spectral-lint (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using StellaOps.Policy.Engine.TrustWeighting;
|
||||
|
||||
namespace StellaOps.Policy.Engine.Tests;
|
||||
|
||||
public sealed class TrustWeightingServiceTests
|
||||
{
|
||||
[Fact]
|
||||
public void Get_ReturnsDefaultsWithHash()
|
||||
{
|
||||
var service = new TrustWeightingService(TimeProvider.System);
|
||||
|
||||
var profile = service.Get();
|
||||
|
||||
Assert.NotEmpty(profile.Weights);
|
||||
Assert.False(string.IsNullOrWhiteSpace(profile.ProfileHash));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Set_NormalizesOrderingAndScale()
|
||||
{
|
||||
var service = new TrustWeightingService(TimeProvider.System);
|
||||
var now = TimeProvider.System.GetUtcNow().ToString("O");
|
||||
|
||||
var profile = service.Set(new[]
|
||||
{
|
||||
new TrustWeightingEntry("Scanner", 1.2345m, " hi ", now),
|
||||
new TrustWeightingEntry("cartographer", 0.9999m, null, now)
|
||||
});
|
||||
|
||||
Assert.Equal(2, profile.Weights.Count);
|
||||
Assert.Equal("cartographer", profile.Weights[0].Source);
|
||||
Assert.Equal(0.999m, profile.Weights[0].Weight);
|
||||
Assert.Equal(1.234m, profile.Weights[1].Weight);
|
||||
Assert.False(string.IsNullOrWhiteSpace(profile.ProfileHash));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user