Exemple #1
0
        public void GivenAnUnRegisteredUser_WhenAUserRegisters_ThenAnExceptionIsThrown()
        {
            _repository.Setup(r => r.Entities).Returns(new System.Collections.Generic.List<User> { new User { Email = "" } }.AsQueryable());

            var service = new UserService(_repository.Object);
            service.UnRegister().Should().BeFalse();
        }
Exemple #2
0
        public void GivenARegisteredUser_WhenAUserUnRegisters_ThenCreateIsCalled()
        {
            _repository.Setup(r => r.Entities).Returns(new System.Collections.Generic.List<User> { new User { Email = "somename" } }.AsQueryable());

            var service = new UserService(_repository.Object);
            service.UnRegister();

            _repository.Verify(r => r.Create(It.IsAny<User>()), Times.Once());
        }