Ejemplo n.º 1
0
        public void GetAllTransactionsAndVerifyGroup()
        {
            CanSaveTransaction();
            CreateNewTransaction(1);

            TransactionController controller = new TransactionController();
            ICollection<Transaction> transactions = controller.GetAllTransaction();
            Assert.IsNotEmpty((ICollection)transactions);

            //checking if Group was fetched
            IList<Transaction> tran = transactions as IList<Transaction>;
            Assert.IsNotNull(tran[0].Group);
        }
Ejemplo n.º 2
0
        public void GetAllTransactionsByGroupId()
        {
            Company c = CompanyFixture.SaveNewMSZCompany();
            TransactionGroup group = GroupFixture.CreateNewTransactionGroup();
            Transaction tran = TransactionFixture.CreateNewTransaction(1);

            UnitOfWork.Current.TransactionalFlush();
            UnitOfWork.CurrentSession.Evict(tran);
            UnitOfWork.CurrentSession.Evict(group);
            UnitOfWork.CurrentSession.Evict(c);

            GroupController controller = new GroupController();
            ICollection<TransactionGroup> groups = controller.GetAllGroups();
            Assert.IsNotEmpty((ICollection)groups);

            TransactionController tr = new TransactionController();
            ICollection<Transaction> transactions = tr.GetAllTransaction();
            Assert.IsNotEmpty((ICollection)transactions);

            transactions = controller.GetAllTransactionForGroup(1);
            Assert.IsNotEmpty((ICollection)transactions);
        }
Ejemplo n.º 3
0
        public void AssignTransactionsToGroup()
        {
            PrepareData();

            TransactionController tr = new TransactionController();
            GroupController gc = new GroupController();

            //only 1 transaction assigned to group 1
            //ICollection<Transaction> transactions = null;
            ICollection<Transaction> transactions = gc.GetAllTransactionForGroup(2);
            Assert.IsTrue(transactions.Count == 1);

            UnitOfWork.Current.TransactionalFlush();
            UnitOfWork.CurrentSession.Evict(transactions);
            UnitOfWork.CurrentSession.Clear();

            //assign 2 other transactions
            gc.AssignTransactionsToGroup(new List<int>() { 1, 2 }, 2);

            //should be 3
            transactions = gc.GetAllTransactionForGroup(2);
            Assert.IsTrue(transactions.Count == 3);

        }