Beispiel #1
0
        public void GivenAnUnregisteredUser_WhenTheUserLogon_ThenTheLogonThrowsAnException()
        {
            _repository.Setup(r => r.Entities).Returns(new System.Collections.Generic.List<User>().AsQueryable());
            var service = new UserService(_repository.Object);
            Action act = () =>service.Logon(It.IsAny<string>(), It.IsAny<string>());

            act.ShouldThrow<ItsaException>();
        }
Beispiel #2
0
 public void GivenARegisteredUser_WhenTheUserLogon_AndTheNameDoesNotMatch_ThenTheLogonFails()
 {
     var user = new User("email", "password");
     _repository.Setup(r => r.Entities).Returns(new System.Collections.Generic.List<User> { user }.AsQueryable());
     var service = new UserService(_repository.Object);
     Assert.Throws<ItsaException>(() => service.Logon("name1", "password"));
 }
Beispiel #3
0
        public void GivenARegisteredUser_WhenTheUserLogon_AndTheNameAndPassowrdMatch_ThenTheLogonSucceeds()
        {
            var user = new User("email", "password");
            _repository.Setup(r => r.Entities).Returns(new System.Collections.Generic.List<User> { user }.AsQueryable());
            var service = new UserService(_repository.Object);

            var loggedinUser =  service.Logon("email", "password");
            loggedinUser.Should().NotBeNull();
        }