public async Task Test_Expense_Find() { #region Arrange var tmpAccount = await FortnoxClient.AccountConnector.CreateAsync(new Account() { Number = TestUtils.GetUnusedAccountNumber(), Description = "TmpAccount" }); #endregion Arrange var remark = TestUtils.RandomString(); var newExpense = new Expense() { Text = remark, Account = tmpAccount.Number }; var connector = FortnoxClient.ExpenseConnector; for (var i = 0; i < 2; i++) { newExpense.Code = TestUtils.RandomString(6); await connector.CreateAsync(newExpense); } var searchSettings = new ExpenseSearch(); searchSettings.LastModified = TestUtils.Recently; //does not seem to work searchSettings.Limit = ApiConstants.Unlimited; var expensesCollection = await connector.FindAsync(searchSettings); var newExpenses = expensesCollection.Entities.Where(x => x.Text == remark).ToList(); Assert.AreEqual(2, newExpenses.Count); Assert.IsNotNull(newExpenses.First().Url); #region Delete arranged resources await FortnoxClient.AccountConnector.DeleteAsync(tmpAccount.Number); #endregion Delete arranged resources }
public void Test_Expense_Find() { #region Arrange var tmpAccount = new AccountConnector().Create(new Account() { Number = TestUtils.GetUnusedAccountNumber(), Description = "TmpAccount" }); #endregion Arrange var timeStamp = DateTime.Now; var remark = TestUtils.RandomString(); var newExpense = new Expense() { Text = remark, Account = tmpAccount.Number }; IExpenseConnector connector = new ExpenseConnector(); for (var i = 0; i < 2; i++) { newExpense.Code = TestUtils.RandomString(6); connector.Create(newExpense); } var searchSettings = new ExpenseSearch(); searchSettings.LastModified = timeStamp; //does not seem to work searchSettings.Limit = APIConstants.Unlimited; var expensesCollection = connector.Find(searchSettings); var newExpenses = expensesCollection.Entities.Where(x => x.Text == remark).ToList(); Assert.AreEqual(2, newExpenses.Count); Assert.IsNotNull(newExpenses.First().Url); #region Delete arranged resources new AccountConnector().Delete(tmpAccount.Number); #endregion Delete arranged resources }