public void Data_Read_Other_User_Account()
        {
            var repository = new AccountRepository(_dataConnectionString, 1);

            var data = repository.Get(5);

            Assert.IsTrue(data == null);
        }
        public void Data_Delete_Account()
        {
            var repository = new AccountRepository(_dataConnectionString, 1);

            var result = repository.Delete(1);

            var account = repository.Get(1);

            Assert.IsTrue(account == null);
            Assert.IsTrue(result.Deleted == true);
            Assert.IsTrue(result.DeletedBy == 1);
            Assert.IsTrue(result.DeletedDate.Value.Date == DateTime.Now.Date);
        }
        public void Data_Read_Account()
        {
            var repository = new AccountRepository(_dataConnectionString, 1);

            var data = repository.Get(1);

            Assert.IsTrue(data.AccountID == 1);
            Assert.IsTrue(data.Name == "Current");
            Assert.IsTrue(data.StartingBalance == 100.00M);
            Assert.IsTrue(data.Default == true);
            Assert.IsTrue(data.Type == AccountType.Current);
            Assert.IsTrue(data.DisplayOrder == 100);
            Assert.IsTrue(data.User_UserID == 1);
            Assert.IsTrue(data.CreatedBy == 1);
            Assert.IsTrue(data.CreatedDate.Date == new DateTime(2015, 1, 1));
            Assert.IsTrue(data.LastModifiedBy == 1);
            Assert.IsTrue(data.LastModifiedDate.Date == new DateTime(2015, 1, 1));
            Assert.IsTrue(data.CurrentBalance == 345.00M);
            Assert.IsTrue(data.IncludeInNetWorth == true);
        }
        public void Data_Update_Account()
        {
            var repository = new AccountRepository(_dataConnectionString, 1);

            var account = repository.Get(1);

            account.Name = "UPDATED";
            account.StartingBalance = 256.12M;
            account.Default = false;
            account.Type = AccountType.CreditCard;
            account.DisplayOrder = 126;
            account.IncludeInNetWorth = false;

            var result = repository.Update(account);

            Assert.IsTrue(result.Name == "UPDATED");
            Assert.IsTrue(result.StartingBalance == 256.12M);
            Assert.IsTrue(result.Default == false);
            Assert.IsTrue(result.Type == AccountType.CreditCard);
            Assert.IsTrue(result.DisplayOrder == 126);
            // This will have been updated by the total calc trigger when the test transactions are inserted
            Assert.IsTrue(result.CurrentBalance == 501.12M);
            Assert.IsTrue(result.LastModifiedBy == 1);
            Assert.IsTrue(result.LastModifiedDate.Date == DateTime.Now.Date);
        }