84 lines
2.5 KiB
C#
84 lines
2.5 KiB
C#
using FluentAssertions;
|
|
using StellaOps.TestKit.Evidence;
|
|
using Xunit;
|
|
|
|
namespace StellaOps.TestKit.Tests;
|
|
|
|
public sealed partial class EvidenceChainTests
|
|
{
|
|
[Fact]
|
|
public void RequirementLinked_PassesWithValidRequirementId()
|
|
{
|
|
var act = () => EvidenceChainAssert.RequirementLinked("REQ-TEST-001");
|
|
act.Should().NotThrow();
|
|
}
|
|
|
|
[Fact]
|
|
public void RequirementLinked_ThrowsWithEmptyRequirementId()
|
|
{
|
|
var act = () => EvidenceChainAssert.RequirementLinked("");
|
|
act.Should().Throw<EvidenceTraceabilityException>()
|
|
.WithMessage("*cannot be empty*");
|
|
}
|
|
|
|
[Fact]
|
|
public void RequirementLinked_ThrowsWithWhitespaceRequirementId()
|
|
{
|
|
var act = () => EvidenceChainAssert.RequirementLinked(" ");
|
|
act.Should().Throw<EvidenceTraceabilityException>();
|
|
}
|
|
|
|
[Fact]
|
|
public void TraceabilityComplete_PassesWithAllComponents()
|
|
{
|
|
var act = () => EvidenceChainAssert.TraceabilityComplete(
|
|
"REQ-001",
|
|
"MyTests.TestMethod",
|
|
"sha256:abc123");
|
|
act.Should().NotThrow();
|
|
}
|
|
|
|
[Fact]
|
|
public void TraceabilityComplete_ThrowsWithMissingRequirement()
|
|
{
|
|
var act = () => EvidenceChainAssert.TraceabilityComplete(
|
|
"",
|
|
"MyTests.TestMethod",
|
|
"sha256:abc123");
|
|
act.Should().Throw<EvidenceTraceabilityException>()
|
|
.WithMessage("*Requirement ID is missing*");
|
|
}
|
|
|
|
[Fact]
|
|
public void TraceabilityComplete_ThrowsWithMissingTestId()
|
|
{
|
|
var act = () => EvidenceChainAssert.TraceabilityComplete(
|
|
"REQ-001",
|
|
null!,
|
|
"sha256:abc123");
|
|
act.Should().Throw<EvidenceTraceabilityException>()
|
|
.WithMessage("*Test ID is missing*");
|
|
}
|
|
|
|
[Fact]
|
|
public void TraceabilityComplete_ThrowsWithMissingArtifactId()
|
|
{
|
|
var act = () => EvidenceChainAssert.TraceabilityComplete(
|
|
"REQ-001",
|
|
"MyTests.TestMethod",
|
|
" ");
|
|
act.Should().Throw<EvidenceTraceabilityException>()
|
|
.WithMessage("*Artifact ID is missing*");
|
|
}
|
|
|
|
[Fact]
|
|
public void TraceabilityComplete_ReportsAllMissingComponents()
|
|
{
|
|
var act = () => EvidenceChainAssert.TraceabilityComplete("", "", "");
|
|
act.Should().Throw<EvidenceTraceabilityException>()
|
|
.WithMessage("*Requirement ID is missing*")
|
|
.WithMessage("*Test ID is missing*")
|
|
.WithMessage("*Artifact ID is missing*");
|
|
}
|
|
}
|