Ejemplo n.º 1
0
        public void Test_Expense_CRUD()
        {
            #region Arrange
            var ac = new AccountConnector();
            if (ac.Get(0123) == null) //account 123 does not exist
            {
                ac.Create(new Account()
                {
                    Number = 0123, Description = "TmpAccount"
                });
            }
            #endregion Arrange

            IExpenseConnector connector = new ExpenseConnector();

            #region CREATE

            var newExpense = new Expense()
            {
                Text    = "TestExpense",
                Code    = TestUtils.RandomString(6),
                Account = 0123
            };

            var createdExpense = connector.Create(newExpense);
            MyAssert.HasNoError(connector);
            Assert.AreEqual("TestExpense", createdExpense.Text);

            #endregion CREATE

            #region UPDATE

            //Not supported

            #endregion UPDATE

            #region READ / GET

            var retrievedExpense = connector.Get(createdExpense.Code);
            MyAssert.HasNoError(connector);
            Assert.AreEqual("TestExpense", retrievedExpense.Text);

            #endregion READ / GET

            #region DELETE

            //Not supported

            #endregion DELETE

            #region Delete arranged resources
            ac.Delete(0123);
            MyAssert.HasNoError(ac);

            #endregion Delete arranged resources
        }
Ejemplo n.º 2
0
        public void Test_Expense_CRUD()
        {
            #region Arrange
            var tmpAccount = new AccountConnector().Create(new Account()
            {
                Number = TestUtils.GetUnusedAccountNumber(), Description = "TmpAccount"
            });
            #endregion Arrange

            IExpenseConnector connector = new ExpenseConnector();

            #region CREATE

            var newExpense = new Expense()
            {
                Text    = "TestExpense",
                Code    = TestUtils.RandomString(6),
                Account = tmpAccount.Number
            };

            var createdExpense = connector.Create(newExpense);
            Assert.AreEqual("TestExpense", createdExpense.Text);

            #endregion CREATE

            #region UPDATE

            //Not supported

            #endregion UPDATE

            #region READ / GET

            var retrievedExpense = connector.Get(createdExpense.Code);
            Assert.AreEqual("TestExpense", retrievedExpense.Text);

            #endregion READ / GET

            #region DELETE

            //Not supported

            #endregion DELETE

            #region Delete arranged resources
            new AccountConnector().Delete(tmpAccount.Number);
            #endregion Delete arranged resources
        }