using Svrnty.CQRS.Abstractions.Discovery; namespace Svrnty.CQRS.Tests; public class CommandMetaTests { [Fact] public void Name_StripsCommandSuffix() { var meta = new CommandMeta(typeof(CreatePersonCommand), typeof(object)); Assert.Equal("CreatePerson", meta.Name); } [Fact] public void Name_UsesCommandNameAttribute_WhenPresent() { var meta = new CommandMeta(typeof(CreateWidgetCommand), typeof(object)); Assert.Equal("customCreate", meta.Name); } [Fact] public void LowerCamelCaseName_ConvertsFirstCharToLower() { var meta = new CommandMeta(typeof(CreatePersonCommand), typeof(object)); Assert.Equal("createPerson", meta.LowerCamelCaseName); } [Fact] public void LowerCamelCaseName_PreservesAlreadyLowerCase() { var meta = new CommandMeta(typeof(CreateWidgetCommand), typeof(object)); // customCreate -> already lower first char Assert.Equal("customCreate", meta.LowerCamelCaseName); } [Fact] public void CommandType_IsSetCorrectly() { var meta = new CommandMeta(typeof(CreatePersonCommand), typeof(object)); Assert.Equal(typeof(CreatePersonCommand), meta.CommandType); } [Fact] public void ServiceType_IsSetCorrectly() { var serviceType = typeof(object); var meta = new CommandMeta(typeof(CreatePersonCommand), serviceType); Assert.Equal(serviceType, meta.ServiceType); } [Fact] public void CommandResultType_IsSetCorrectly_WithThreeArgConstructor() { var meta = new CommandMeta(typeof(CreatePersonCommand), typeof(object), typeof(CreatePersonResult)); Assert.Equal(typeof(CreatePersonResult), meta.CommandResultType); } [Fact] public void CommandResultType_IsNull_WithTwoArgConstructor() { var meta = new CommandMeta(typeof(DeletePersonCommand), typeof(object)); Assert.Null(meta.CommandResultType); } }