stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using StellaOps.TestKit.Interop;
|
||||
using Xunit;
|
||||
|
||||
namespace StellaOps.TestKit.Tests;
|
||||
|
||||
public sealed partial class InteropTests
|
||||
{
|
||||
[Fact]
|
||||
public void SchemaVersionMatrix_Analyze_GeneratesReport()
|
||||
{
|
||||
var matrix = new SchemaVersionMatrix();
|
||||
matrix.AddVersion("1.0", new SchemaDefinition { RequiredFields = ["id"] });
|
||||
matrix.AddVersion("2.0", new SchemaDefinition { RequiredFields = ["id", "name"] });
|
||||
|
||||
var report = matrix.Analyze();
|
||||
|
||||
report.Versions.Should().Contain(["1.0", "2.0"]);
|
||||
report.Pairs.Should().HaveCount(2);
|
||||
report.GeneratedAt.Should().NotBe(default);
|
||||
report.GeneratedAt.Offset.Should().Be(TimeSpan.Zero);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SchemaVersionMatrix_Analyze_SortsVersions()
|
||||
{
|
||||
var matrix = new SchemaVersionMatrix();
|
||||
matrix.AddVersion("2.0", new SchemaDefinition { RequiredFields = ["id"] });
|
||||
matrix.AddVersion("1.0", new SchemaDefinition { RequiredFields = ["id"] });
|
||||
|
||||
var report = matrix.Analyze();
|
||||
|
||||
report.Versions.Should().ContainInOrder("1.0", "2.0");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SchemaVersionMatrix_Analyze_DetectsTypeChanges()
|
||||
{
|
||||
var matrix = new SchemaVersionMatrix();
|
||||
matrix.AddVersion("1.0", new SchemaDefinition
|
||||
{
|
||||
RequiredFields = ["id"],
|
||||
FieldTypes = new() { ["id"] = "int" }
|
||||
});
|
||||
matrix.AddVersion("2.0", new SchemaDefinition
|
||||
{
|
||||
RequiredFields = ["id"],
|
||||
FieldTypes = new() { ["id"] = "string" }
|
||||
});
|
||||
|
||||
var report = matrix.Analyze();
|
||||
|
||||
var pair = report.Pairs.First(p => p.FromVersion == "1.0" && p.ToVersion == "2.0");
|
||||
pair.IsBackwardCompatible.Should().BeFalse();
|
||||
pair.BackwardIssues.Should().Contain(i => i.Contains("Type changed"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user