public EditArticleWindow(Article article)
        {
            InitializeComponent();

            _article = article;
            _editArticleViewModel = new EditArticleViewModel(article);
            this.DataContext = _editArticleViewModel;
        }
Exemple #2
0
 public void TestRemove()
 {
     Assert.AreEqual(_workspace.Articles.Count, 0);
     var article = new Article();
     _workspace.Add(article);
     Assert.AreEqual(_workspace.Articles.Count, 1);
     Assert.IsTrue(_workspace.Remove(article));
     Assert.AreEqual(_workspace.Articles.Count, 0);
 }
Exemple #3
0
        public void CopyFrom()
        {
            Article article = new Article();
            Article sourceArticle = MockArticle();

            article.CopyFrom(sourceArticle);

            CheckEqual(article, sourceArticle);
        }
 public EditArticleViewModel(Article article)
 {
     _article = article;
     if (_article.PublicDate == null)
     {
         _article.PublicDate = DateTime.Now.ToShortDateString();
     }
     _publicDate = DateTime.Parse(_article.PublicDate);
 }
        private DeleteImagesCommand CreateStubDeleteImagesCommand(out Article article)
        {
            article = new Article()
            {
                ArticleText = File.ReadAllText("articletext.txt"),
                Images = new List<string>()
            };
            article.Images.Add("10960593_files/1.jpg");
            article.Images.Add("10960593_files/2.jpg");

            var articles = new List<Article>();
            articles.Add(article);

            var deleteImagesCommand = new DeleteImagesCommand(articles);

            return deleteImagesCommand;
        }
Exemple #6
0
        private void CheckEqual(Article article, Article articleCopy)
        {
            Assert.AreEqual(article.ArticleText, articleCopy.ArticleText);
            Assert.AreEqual(article.ArticleOriginText, articleCopy.ArticleOriginText);
            Assert.AreEqual(article.Author, articleCopy.Author);
            Assert.AreEqual(article.Category, articleCopy.Category);
            Assert.AreEqual(article.CategoryEmpty, articleCopy.CategoryEmpty);
            Assert.AreEqual(article.Filepath, articleCopy.Filepath);
            Assert.AreEqual(article.Id, articleCopy.Id);
            Assert.AreEqual(article.IdMain, articleCopy.IdMain);
            Assert.AreEqual(article.KeyWords, articleCopy.KeyWords);

            Assert.AreEqual(article.Mark, articleCopy.Mark);
            Assert.AreEqual(article.PublicDate, articleCopy.PublicDate);
            Assert.AreEqual(article.Region, articleCopy.Region);
            Assert.AreEqual(article.Source, articleCopy.Source);
            Assert.AreEqual(article.SourceNumber, articleCopy.SourceNumber);
            Assert.AreEqual(article.SubjectCategory, articleCopy.SubjectCategory);
            Assert.AreEqual(article.Title, articleCopy.Title);

            CollectionAssert.AreEqual(article.Images as List<string>, articleCopy.Images as List<string>);
        }
Exemple #7
0
        private Article MockArticle()
        {
            Article article = new Article()
            {
                ArticleText = "wefwefw",
                ArticleOriginText = "wefwefw123gwerg",
                Author = "fwefwef",
                Category = "fwefwefcvc",
                CategoryEmpty = "wefwef",
                Filepath = "wefwthmywhy",
                Id = 123,
                IdMain = 4234,
                Images = new List<string>(),
                KeyWords = "fwefw",
                Mark = 12,
                PublicDate = "111.04.2014",
                Region = "Kyiv",
                Source = "fwefw",
                SourceNumber = "ewfwfe",
                SubjectCategory = "wefwefw",
                Title = "Title"
            };

            article.Images.Add("wefwf");
            article.Images.Add("gfgerg");

            return article;
        }
Exemple #8
0
        private static bool Equals(Article first, Article second)
        {
            if (first.Title == null || second.Title == null)
                return false;

            return first.Title.ToUpper().Equals(second.Title.ToUpper());
        }
Exemple #9
0
        private void TestKievArticle(Article article, bool full = true)
        {
            Assert.IsTrue(article.Source.Equals("Continent"));
            Assert.IsTrue(article.Title.Equals("В центре Киева прошел ежегодный марафон"));
            Assert.IsTrue(article.Category.Equals("Интернет"));
            Assert.IsFalse(string.IsNullOrEmpty(article.Filepath));

            if (full)
            {
                Assert.IsTrue(article.PublicDate.Equals("28.09.2015 11:58"));
                Assert.IsTrue(article.KeyWords.Equals("ВДНХ"));
                Assert.IsTrue(article.Author.Equals("http://continent-news.info/newsinfo.html?unitId=941808"));
            }
            else
            {
                Assert.IsTrue(article.PublicDate.Equals("28.09.2015"));
            }
        }
Exemple #10
0
        private void TestUkrGazBankArticle(Article article, bool full = true)
        {
            Assert.IsTrue(article.Title.Equals("Укргазбанк  виділяє кредит для ПАТ \"Аграрний фонд\" на 300 млн грн. під 25% річних"));
            Assert.IsTrue(article.Category.Equals("Интернет"));
            Assert.IsFalse(string.IsNullOrEmpty(article.Filepath));

            if (full)
            {
                Assert.IsTrue(article.Source.Equals("Экономические известия (www.eizvestia.com)"));
                Assert.IsTrue(article.PublicDate.Equals("28.09.2015 11:24"));
                Assert.IsTrue(article.KeyWords.Equals("ВДНХ"));
                Assert.IsTrue(article.Author.Equals("http://m.eizvestia.com/m?cat=news_kiev&url=153-v-centre-kieva-proshel-ezhegodnyj-marafon"));
            }
            else
            {
                Assert.IsTrue(article.Source.Equals("FINBALANCE"));
                Assert.IsTrue(article.PublicDate.Equals("20.10.2015"));
            }
        }
Exemple #11
0
 public bool Remove(Article article)
 {
     return _articles.Remove(article);
 }
Exemple #12
0
 public void Add(Article article)
 {
     _articles.Add(article);
 }
Exemple #13
0
        public void CopyFrom(Article article)
        {
            ArticleText = article.ArticleText;
            ArticleOriginText = article.ArticleOriginText;
            Author = article.Author;
            Category = article.Category;
            CategoryEmpty = article.CategoryEmpty;
            Filepath = article.Filepath;
            Id = article.Id;
            IdMain = article.IdMain;
            KeyWords = article.KeyWords;
            Mark = article.Mark;
            PublicDate = article.PublicDate;
            Region = article.Region;
            Source = article.Source;
            SourceNumber = article.SourceNumber;
            SubjectCategory = article.SubjectCategory;
            Title = article.Title;

            Images = (article.Images as List<string>).ToList();
        }
Exemple #14
0
        public Article Copy()
        {
            Article copy = new Article();

            copy.ArticleText = ArticleText;
            copy.ArticleOriginText = ArticleOriginText;
            copy.Author = Author;
            copy.Category = Category;
            copy.CategoryEmpty = CategoryEmpty;
            copy.Filepath = Filepath;
            copy.Id = Id;
            copy.IdMain = IdMain;
            copy.KeyWords = KeyWords;
            copy.Mark = Mark;
            copy.PublicDate = PublicDate;
            copy.Region = Region;
            copy.Source = Source;
            copy.SourceNumber = SourceNumber;
            copy.SubjectCategory = SubjectCategory;
            copy.Title = Title;

            if (Images != null)
            {
                copy.Images = (Images as List<string>).ToList();
            }
            else
            {
                copy.Images = null;
            }

            return copy;
        }