Example #1
0
        public void GetAllCollaboratorsShouldReturnZeroWithInvalidStoryIdTest()
        {
            var expenseStory1 = GetNewMockPersonalExpenseStory(user.UserId);
            var expectedCollaboratorsCount = 0;

            var actualCollaboratorsCount = collaboratorMgr.GetAllCollaborators(expenseStory1.ExpenseStoryId).Count();

            Assert.AreEqual(expectedCollaboratorsCount, actualCollaboratorsCount);
        }
Example #2
0
        public void GetAllCollaboratorsTest()
        {
            var expenseStory1          = GetNewMockPersonalExpenseStory(user.UserId);
            var collaborator1          = GetNewMockCollaborator(user.UserId, expenseStory1.ExpenseStoryId);
            var collaborator2          = GetNewMockCollaborator(user.UserId, expenseStory1.ExpenseStoryId);
            var collaborator3          = GetNewMockCollaborator(user.UserId, expenseStory1.ExpenseStoryId);
            var collaboratorMgr        = new CollaboratorManager(new CollaboratorRepository(dbFactory), unitOfWork);
            var expenseStoryRepository = new ExpenseStoryRepository(dbFactory);

            new ExpenseStoryManager(expenseStoryRepository, unitOfWork,
                                    new ExpenseManager(new ExpenseRepository(dbFactory), unitOfWork),
                                    new CollaboratorManager(new CollaboratorRepository(dbFactory), unitOfWork)).AddExpenseStory(expenseStory1);
            var expectedCollaboratorsCount = 3;

            collaboratorMgr.AddCollaborator(collaborator1);
            collaboratorMgr.AddCollaborator(collaborator2);
            collaboratorMgr.AddCollaborator(collaborator3);

            var actualCollaboratorsCount = collaboratorMgr.GetAllCollaborators(expenseStory1.ExpenseStoryId).Count();

            Assert.AreEqual(expectedCollaboratorsCount, actualCollaboratorsCount);
        }