public async Task Injection() { var pathResolver = new InMemoryFileAccessor <ClizerDictionary>(new ClizerDictionary()); var clizer = new Clizer() .Configure((config) => config .EnableMapping(pathResolver) .RegisterCommands <MappingCommand>()); var result = await clizer.Execute(Array.Empty <string>()); Assert.Equal(ClizerExitCode.SUCCESS, result); }
public async Task Inject_Config() { var fileAccessor = new InMemoryFileAccessor <TestUserConfiguration>( new TestUserConfiguration() { Value = 99 }); var clizer = new Clizer() .Configure((config) => config .EnableConfig("config", fileAccessor) .RegisterCommands <UserConfigCommand>()); var result = await clizer.Execute(Array.Empty <string>()); Assert.Equal(ClizerExitCode.SUCCESS, result); }
public async Task Runtime() { var args = new List <string>() { "ut" }; var aliases = "ut = unit test al \r\n al = aliases"; var fileAccessor = new InMemoryFileAccessor <string>(aliases); var clizer = new Clizer() .Configure(config => config .EnableAliases(fileAccessor) .RegisterCommands(GetType().Assembly)); var result = await clizer.Execute(args.ToArray()); Assert.Equal(ClizerExitCode.SUCCESS, result); }
public async Task Map_To_Short_Id() { var pathResolver = new InMemoryFileAccessor <ClizerDictionary>(new ClizerDictionary()); var mapper = new ClizerMapper(pathResolver); var entity1 = new TestEntity(); var entity2 = new TestEntity(); var mapping1 = await mapper.MapId(entity1, x => x.Id, -10, default); var mapping2 = await mapper.MapId(entity2, x => x.Id, 10, default); var reverse1 = mapper.GetByShortId <TestEntity>(mapping1.ShortId); var reverse2 = mapper.GetByShortId <TestEntity>(mapping2.ShortId); Assert.Null(reverse1); Assert.Equal(entity2.Id, reverse2); }