private static async Task <int> Main(string[] args) { var command = args[0]; Console.WriteLine(args[0]); if (command == "postbuild") { PostBuild.Execute(args[1]); return(0); } var sender = new CommandSender(new QueueClient(new ServiceBusConnectionStringBuilder(Configuration["CommandServiceBusConnectionString"]))); switch (command) { case "add": await sender.SendAdd(args[1], args[2], Int32.Parse(args[3]), "CLI_home"); break; case "remove": await sender.SendRemove(args[1], args[2], Int32.Parse(args[3]), "CLI_home"); break; case "dumpredis": Console.WriteLine("Deprecated;"); break; default: return(0); } return(0); }
public async Task SendAdd_CallsSendAsync_WithMessage() { var mockQueueClient = new Mock <IQueueClient>(); mockQueueClient.Setup(queue => queue.SendAsync(It.IsAny <Message>())); var structureUnderTest = new CommandSender(mockQueueClient.Object); await structureUnderTest.SendAdd("somePlayerId", "someTarget", 0, "Test"); mockQueueClient.Verify(client => client.SendAsync(It.IsAny <Message>())); }
private IEnumerable <Task> AddPoints(IUser user, int amountOfPoints) => new[] { _sender.SendAdd(Context.User.Username, user.Username, amountOfPoints, Source(Context.Guild.Id)), Context.Channel.SendMessageAsync("Transaction complete.") };