Exemple #1
0
        public void ThrowArgumentNullException_WhenUserDtoIsNull()
        {
            //Arrange
            var usersRepoMock      = new Mock <IEfRepository <RegularUser> >();
            var regularUserService = new Services.RegularUserService(usersRepoMock.Object);

            //Act && Assert
            Assert.Throws <ArgumentNullException>(() => regularUserService.Update(null));
        }
Exemple #2
0
        public void NotCallRegularUserRepoUpdate_WhenUserIsNonExistent()
        {
            //Arrange
            var usersRepoMock = new Mock <IEfRepository <RegularUser> >();
            var userDto       = new RegularUserDto()
            {
                Id = Guid.NewGuid().ToString()
            };
            var         regularUserService = new Services.RegularUserService(usersRepoMock.Object);
            RegularUser nullUserFromRepo   = null;

            usersRepoMock.Setup(m => m.GetById(userDto.Id)).Returns(nullUserFromRepo);

            //Act
            regularUserService.Update(userDto);

            //Assert
            usersRepoMock.Verify(m => m.Update(nullUserFromRepo), Times.Never);
        }