public AppUsersControllerTests()
        {
            _mockRepo           = new Mock <IAppUserRepository>();
            _appUsersController = new AppUsersController(_mockRepo.Object);

            _appUsers = new List <AppUserDTO>
            {
                new AppUserDTO {
                    AccountId = 1, Name = "Ryan"
                },
                new AppUserDTO {
                    AccountId = 2, Name = "Alice"
                }
            };
        }
Exemplo n.º 2
0
        public void ShouldSearchAllAppUsersByUserType()
        {
            List <ApplicationUser> mockAppUsersList = CreateMockAppUsersData();

            mockApplicationUserRepo.Setup(m => m.ListAllAppUsers()).Returns(mockAppUsersList);

            int expectedAppUsers = 1;

            AppUsersController controller = new AppUsersController(mockApplicationUserRepo.Object);

            AppUserSearchViewModel viewModel = new AppUserSearchViewModel();

            viewModel.appUserType = "Visitor";

            ViewResult result = controller.SearchAppUsers(viewModel) as ViewResult;

            AppUserSearchViewModel resultModel = result.Model as AppUserSearchViewModel;

            List <ApplicationUser> actualApplicationUserList = resultModel.AppUserSearchResult;

            int actualAppUsers = actualApplicationUserList.Count;

            Assert.Equal(expectedAppUsers, actualAppUsers);
        }