예제 #1
0
        public void UserServiceRegisterEmailIsNullFailTest()
        {
            var repoMock = new Mock <IRepository <User> >();

            repoMock.Setup(m => m.GetAll())
            .Returns(() => new List <User>
            {
                new User("John", "Doe"),
                new User("Steve", "Jobs"),
                new User("Bill", "Gates"),
            });
            var service  = new UserService(repoMock.Object);
            var login    = "";
            var password = "******";
            var user     = service.Register(login, password);

            Assert.Equal("EmailIsNull", user);
        }
예제 #2
0
        public void UserServiceRegisterPasswordTooShortOkTest()
        {
            var repoMock = new Mock <IRepository <User> >();

            repoMock.Setup(m => m.GetAll())
            .Returns(() => new List <User>
            {
                new User("John", "Doe"),
                new User("Steve", "Jobs"),
                new User("Bill", "Gates"),
            });
            var service  = new UserService(repoMock.Object);
            var login    = "******";
            var password = "******";
            var user     = service.Register(login, password);

            Assert.Equal("OK", user);
        }