示例#1
0
        public async Task ExpectAddExpenseAsync(string accountName, decimal amount, string category, string subcategory, Action <Expense> modEx = null, Action <CreateExpenseCommand> modCmd = null, HttpStatusCode expectedStatus = HttpStatusCode.OK)
        {
            var expense = new Expense(amount, category, subcategory)
            {
                Date = DateTime.Now.Date
            };

            modEx?.Invoke(expense);

            var cmd = expense.AsCommand(accountName);

            modCmd?.Invoke(cmd);

            (await this.Client.PostAsync($"/api/account/{accountName}/expenses", cmd.AsContent())).StatusCode.Should().Be(expectedStatus);
        }