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

            //Act && Assert
            Assert.Throws <ArgumentException>(() => regularUserService.UpdateAvatarUrl(string.Empty, "raandoomStriing2"));
        }
Exemple #2
0
        public void NotCallRegularUserRepoUpdate_WhenUserIsNonExistent()
        {
            //Arrange
            var         usersRepoMock      = new Mock <IEfRepository <RegularUser> >();
            string      userId             = Guid.NewGuid().ToString();
            var         regularUserService = new Services.RegularUserService(usersRepoMock.Object);
            RegularUser nullUserFromRepo   = null;

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

            //Act
            regularUserService.UpdateAvatarUrl(userId, "tootaallyyRandomAvatarUrl2");

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