Exemplo n.º 1
0
        public void ThrowArgumentException_WhenIdIsEmpty()
        {
            //Arrange
            var usersRepoMock      = new Mock <IEfRepository <RegularUser> >();
            var regularUserService = new Services.RegularUserService(usersRepoMock.Object);

            //Act && Assert
            Assert.Throws <ArgumentException>(() => regularUserService.Create(string.Empty, "randomNotNullOrEmptyStringEmail", null, null));
        }
Exemplo n.º 2
0
        public void ThrowArgumentException_WhenEmailIsEmpty()
        {
            //Arrange
            var usersRepoMock      = new Mock <IEfRepository <RegularUser> >();
            var regularUserService = new Services.RegularUserService(usersRepoMock.Object);

            //Act && Assert
            Assert.Throws <ArgumentException>(() => regularUserService.Create(Guid.NewGuid().ToString(), string.Empty, null, null));
        }
Exemplo n.º 3
0
        public void CallRegularUserRepoAddOnce_WhenIdIsValid()
        {
            //Arrange
            var usersRepoMock      = new Mock <IEfRepository <RegularUser> >();
            var regularUserService = new Services.RegularUserService(usersRepoMock.Object);
            var id = Guid.NewGuid().ToString();

            //Act
            regularUserService.Create(id, "randomNotNullOrEmptyStringEmail", null, null);

            //Assert
            usersRepoMock.Verify(m => m.Add(It.IsAny <RegularUser>()), Times.Once);
        }