Ejemplo n.º 1
0
        public ManagerTests()
        {
            userRepo.SetValidator(userValidator);
            articleRepo.SetValidator(articleValidator);
            authorRepo.SetValidator(authorValidator);

            manager = new Manager(userRepo, authorRepo, articleRepo);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            UserRepo userRepo = new UserRepo();
            ArticleRepo articleRepo = new ArticleRepo();
            AuthorRepo authorRepo = new AuthorRepo();

            UserValidator userValidator = new UserValidator();
            ArticleValidator articleValidator = new ArticleValidator();
            AuthorValidator authorValidator = new AuthorValidator();

            userRepo.SetValidator(userValidator);
            articleRepo.SetValidator(articleValidator);
            authorRepo.SetValidator(authorValidator);

            Manager manager = new Manager(userRepo, authorRepo, articleRepo);

            ConsoleUI console = new ConsoleUI(manager);
            console.Run();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            UserRepo    userRepo    = new UserRepo();
            ArticleRepo articleRepo = new ArticleRepo();
            AuthorRepo  authorRepo  = new AuthorRepo();

            UserValidator    userValidator    = new UserValidator();
            ArticleValidator articleValidator = new ArticleValidator();
            AuthorValidator  authorValidator  = new AuthorValidator();

            userRepo.SetValidator(userValidator);
            articleRepo.SetValidator(articleValidator);
            authorRepo.SetValidator(authorValidator);

            Manager manager = new Manager(userRepo, authorRepo, articleRepo);

            ConsoleUI console = new ConsoleUI(manager);

            console.Run();
        }
Ejemplo n.º 4
0
        public void RepoTest()
        {
            Assert.AreEqual(1, 1);

            _userRepository.SetValidator(userValidator);
            _articleRepository.SetValidator(articleValidator);
            _authorRepository.SetValidator(authorValidator);


            _userRepository.Save(user);
            _authorRepository.Save(author);
            _articleRepository.Save(article);

            ArrayList users    = _userRepository.GetAll();
            ArrayList authors  = _authorRepository.GetAll();
            ArrayList articles = _articleRepository.GetAll();

            Assert.IsNotNull(users[0]);

            User    userResult    = (User)users[0];
            Author  authorResult  = (Author)authors[0];
            Article articleResult = (Article)articles[0];

            _userRepository.SetXMLFilename("test.xml");
            _userRepository.SaveAllToXML();

            UserRepo second = new UserRepo();

            second.SetXMLFilename("test.xml");
            second.LoadAllFromXML();

            second.SetXMLFilename("w");

//            Assert.AreEqual(Constants.StringTest, userResult.Username);
//            Assert.AreEqual(Constants.StringTest, authorResult.Name);
//            Assert.AreEqual(Constants.StringTest, articleResult.Title);
        }