public async Task FetchEmployeeNamesTest()
        {
            // Arrange
            int EmployeeManagerId = 2;
            var users             = new List <UserInformation>
            {
                new UserInformation
                {
                    ManagerId   = EmployeeManagerId,
                    IsConfirmed = true
                },
                new UserInformation
                {
                    ManagerId   = EmployeeManagerId,
                    IsConfirmed = true
                },
                new UserInformation
                {
                    ManagerId   = EmployeeManagerId,
                    IsConfirmed = true
                }
            };

            var fixture = new EmployeeServiceFixture()
                          .InitializeContext()
                          .InitializeUserInformationDbSet(users)
                          .CreateService();

            // Act
            var userListDto = await fixture.Service.FetchEmployeeNames(EmployeeManagerId);

            // Assert
            Assert.AreEqual(3, userListDto.Count);
            CollectionAssert.AllItemsAreNotNull(userListDto.ToList());
        }
        public async Task FetchEmployeeProjectsTest()
        {
            // Arrange
            int userId     = 1;
            int pageNum    = 1;
            int numPerPage = 3;

            var userProjectRelation = new List <UserProjectRelation>
            {
                new UserProjectRelation
                {
                    ProjectId = 1,
                    UserId    = userId
                },
                new UserProjectRelation
                {
                    ProjectId = 2,
                    UserId    = userId
                },
                new UserProjectRelation
                {
                    ProjectId = 3,
                    UserId    = userId
                }
            };

            var userProjects = new List <UserProject>
            {
                new UserProject
                {
                    ProjectId           = 1,
                    UserProjectRelation = userProjectRelation
                },
                new UserProject
                {
                    ProjectId           = 2,
                    UserProjectRelation = userProjectRelation
                },
                new UserProject
                {
                    ProjectId           = 3,
                    UserProjectRelation = userProjectRelation
                }
            };

            var fixture = new EmployeeServiceFixture()
                          .InitializeContext()
                          .InitializeUserProjectDbSet(userProjects)
                          .InitializeUserProjectRelationDbSet(userProjectRelation)
                          .CreateService();

            // Act
            var result = await fixture.Service.FetchEmployeeProjects(userId, pageNum, numPerPage) as PagerListDto;

            // Assert
            Assert.AreEqual(3, result.TotalCount);
            CollectionAssert.AllItemsAreNotNull(result.Items.ToList());
        }
        public async Task FetchEmployeeProjectsListTest()
        {
            // Arrange
            int userId = 1;
            var userProjectRelation = new List <UserProjectRelation>
            {
                new UserProjectRelation
                {
                    ProjectId = 1,
                    UserId    = userId
                },
                new UserProjectRelation
                {
                    ProjectId = 2,
                    UserId    = userId
                },
                new UserProjectRelation
                {
                    ProjectId = 3,
                    UserId    = userId
                }
            };

            var projects = new List <UserProject>
            {
                new UserProject
                {
                    ProjectId           = 1,
                    UserProjectRelation = userProjectRelation
                },
                new UserProject
                {
                    ProjectId           = 2,
                    UserProjectRelation = userProjectRelation
                },
                new UserProject
                {
                    ProjectId           = 3,
                    UserProjectRelation = userProjectRelation
                }
            };

            var fixture = new EmployeeServiceFixture()
                          .InitializeContext()
                          .InitializeUserProjectDbSet(projects)
                          .CreateService();

            // Act
            var result = await fixture.Service.FetchEmployeeProjectsList(userId);

            // Assert
            Assert.AreEqual(3, result.Count);
            CollectionAssert.AllItemsAreNotNull(result.ToList());
        }
        public void FetchEmployeeNamesContextCreateAtLeastOnceTest()
        {
            var fixture = new EmployeeServiceFixture()
                          .InitializeContext()
                          .CreateService();

            // Act
            fixture.Service.FetchEmployeeNames(It.IsAny <int>());

            // Assert
            Mock.Get(fixture.ContextFactoryMock).Verify(f => f.CreateContext(), Times.AtLeastOnce);
        }