public void ChangeRestrictions_ShouldReturnUpdatedUser(int userId, int consecLimit, int monthlyLimit, int yearlyLimit) { var expectedUser = GetUserById(userId); expectedUser.ConsecLimit = consecLimit; expectedUser.MonthlyLimit = monthlyLimit; expectedUser.YearlyLimit = yearlyLimit; var daoMock = new Mock <IUsersDao>(MockBehavior.Strict); var newUserRestrictions = new UserRestrictions { ConsecLimit = consecLimit, MonthlyLimit = monthlyLimit, YearlyLimit = yearlyLimit }; daoMock.Setup(x => x.UpdateUser(expectedUser)) .Verifiable("UpdateUserAsync method was not called with expected arguments"); daoMock.Setup(x => x.SelectByID(It.IsAny <int>())) .Returns <int>(id => GetUserById(id)); var sut = new UserLogic(daoMock.Object, null, null); var actual = sut.ChangeRestrictions(newUserRestrictions, userId); Assert.IsTrue(UsersAreEqual(expectedUser, actual)); daoMock.Verify(x => x.UpdateUser(expectedUser), Times.Once); }