public void ChangeFirstnameTest() { //Arrange int index = 0; var testUser = GetUserCollection().ElementAt(index); //Act userMockRepository.Setup(x => x.Get(index.ToString())).Returns(GetUserCollection().ElementAt(index)); mapper.Setup(x => x.Map <User>(It.IsAny <User>())).Returns(GetUserCollection().ElementAt(index)); userService.ChangeFirstname(testUser, "NewFirstname"); //Assert Assert.Equal(testUser.FirstName, "NewFirstname"); }