Exemplo n.º 1
0
        public void Edit_NonExistingUser_ThrowsNonExistingUserException()
        {
            var user = new User {
                Id = 1
            };
            var getUserData = new Mock <IGetUserData>();

            getUserData.Setup(x => x.GetDataWithoutArtworks(user.Id)).Returns((User)null);

            var sut = new PatchUser(getUserData.Object, _sqlBuilder.Object, _sqlQuery.Object);

            Assert.That(() => sut.Edit(user), Throws.Exception.TypeOf <NonExistingUserException>());
        }
Exemplo n.º 2
0
        public void Edit_NoChangesToUser_ReturnsSameUser()
        {
            var user = new User {
                Id = 1
            };
            var getUserData = new Mock <IGetUserData>();

            getUserData.Setup(x => x.GetDataWithoutArtworks(user.Id)).Returns(user);

            var sut = new PatchUser(getUserData.Object, _sqlBuilder.Object, _sqlQuery.Object);

            var result = sut.Edit(user);

            Assert.That(result, Is.EqualTo(user));
        }