Example #1
0
        public void throws_exception_when_adding_user_without_username()
        {
            var logger = new Mock<IUserLogger>();
            var handler = new UserHandler(logger.Object);

            var invalidUser = new User
            {
                UserName = "",
                Email = "*****@*****.**"
            };

            handler.Save(invalidUser);
        }
Example #2
0
        public void logs_valid_user()
        {
            var logger = new Mock<IUserLogger>();

            var handler = new UserHandler(logger.Object);

            var user = new User()
            {
                UserName = "******",
                Email = "*****@*****.**"
            };

            handler.Save(user);
            logger.Verify(method => method.Log(It.IsAny<User>()), Times.Once, "We did not log once");
        }