public void GetUsers_UserRepositoryIsCalledOnce() { //ARRANGE MockUserRepository.Setup(x => x.GetAll()).Returns(UserList); MockUofW.Setup(x => x.UserRepository).Returns(MockUserRepository.Object); var ass = new RSAssistantRole(MockUofW.Object); //ACT var usersAll = ass.GetUsers(); //ASSERT MockUserRepository.Verify(x => x.GetAll(), Times.Once); }
public void GetUsers_ReturnsAllUsersFromDB() { //ARRANGE MockUserRepository.Setup(x => x.GetAll()).Returns(UserList); MockUofW.Setup(x => x.UserRepository).Returns(MockUserRepository.Object); var ass = new RSAssistantRole(MockUofW.Object); //ACT var users = ass.GetUsers(); //ASSERT Assert.AreEqual(UserList().Count, users.Count); Assert.AreEqual(3, users.Count); }