Initial commit: SWP.Core enterprise framework with multi-tenant architecture, configuration management, security, telemetry and comprehensive test suite
This commit is contained in:
commit
5275a75502
87 changed files with 6140 additions and 0 deletions
63
Tests/CommandQueries/CommandTests.cs
Normal file
63
Tests/CommandQueries/CommandTests.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Shouldly;
|
||||
using SWP.Core.CommandQueries;
|
||||
|
||||
namespace SWP.Core.X.TDD.CommandQueries;
|
||||
|
||||
[TestClass]
|
||||
public class CommandTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Command_ShouldHaveCorrelationId()
|
||||
{
|
||||
// Arrange & Act
|
||||
var correlationId = Guid.NewGuid();
|
||||
var command = new TestCommand { CorrelationId = correlationId };
|
||||
|
||||
// Assert
|
||||
command.CorrelationId.ShouldBe(correlationId);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Command_ShouldHaveTransactionId()
|
||||
{
|
||||
// Arrange & Act
|
||||
var correlationId = Guid.NewGuid();
|
||||
var transactionId = Guid.NewGuid();
|
||||
var command = new TestCommand { CorrelationId = correlationId };
|
||||
command.TransactionId = transactionId;
|
||||
|
||||
// Assert
|
||||
command.TransactionId.ShouldBe(transactionId);
|
||||
}
|
||||
|
||||
private class TestCommand : Command
|
||||
{
|
||||
public string TestProperty { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
[TestClass]
|
||||
public class ProblemDetailsTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void ProblemDetails_ShouldHaveBasicProperties()
|
||||
{
|
||||
// Arrange & Act
|
||||
var problem = new ProblemDetails
|
||||
{
|
||||
Type = "ValidationError",
|
||||
Title = "Validation Failed",
|
||||
Status = 400,
|
||||
Detail = "Email is required",
|
||||
Instance = "/api/users"
|
||||
};
|
||||
|
||||
// Assert
|
||||
problem.Type.ShouldBe("ValidationError");
|
||||
problem.Title.ShouldBe("Validation Failed");
|
||||
problem.Status.ShouldBe(400);
|
||||
problem.Detail.ShouldBe("Email is required");
|
||||
problem.Instance.ShouldBe("/api/users");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue