public void ModifyUpdatePhrasesWithEntityNull() { Entity entity = new Entity("Microsoft"); REPOSITORY.Add(entity); SentimentRepository sentimentRepository = new SentimentRepository(); PhraseRepository phraseRepository = new PhraseRepository(); AuthorRepository authorRepository = new AuthorRepository(); authorRepository.Add(AUTHOR); try { sentimentRepository.Add(new Sentiment(SentimentType.POSITIVE, "i like")); } catch (AnalysisException) { } Phrase phrase = new Phrase("I like Uber", DateTime.Now, AUTHOR); try { phraseRepository.Add(phrase); } catch (AnalysisException) { } entity.Name = "Uber"; REPOSITORY.Modify(entity.Id, entity); Assert.AreEqual(phraseRepository.Get(phrase.Id).Entity, entity); }
public void AddUpdateAlarm() { EntityRepository entityRepository = new EntityRepository(); entityRepository.Add(ENTITITES.First(e => e.Name.Equals("Starbucks"))); EntityAlarmRepository alarmRepository = new EntityAlarmRepository(); EntityAlarm alarm = new EntityAlarm("1", "1", SentimentType.NEGATIVE, ENTITITES.First(e => e.Name.Equals("Starbucks"))); alarmRepository.Add(alarm); SentimentRepository sentimentRepository = new SentimentRepository(); sentimentRepository.Add(new Sentiment(SentimentType.NEGATIVE, "i dont like")); AuthorRepository authorRepository = new AuthorRepository(); authorRepository.Add(AUTHOR); Phrase phrase = new Phrase("I dont like Starbucks", DateTime.Now, AUTHOR); REPOSITORY.Add(phrase); Assert.AreEqual(alarmRepository.Get(alarm.Id).PostCount, 1); }
public void NotEmpty() { SentimentRepository repository = new SentimentRepository(); repository.Add(SENTIMENT); Assert.IsFalse(repository.IsEmpty()); }
public void GetById() { SentimentRepository repository = new SentimentRepository(); repository.Add(SENTIMENT); Assert.IsNotNull(repository.Get(SENTIMENT.Id)); }
public void SetUp() { REPOSITORY = new SentimentRepository(); CleanRepositories(); AUTHOR = new Author("sada", "sadasd", "sdaasd", new DateTime(1995, 2, 3)); SENTIMENT = new Sentiment(SentimentType.POSITIVE, "Me gusta"); }
public void DeleteSentiment() { SentimentRepository repository = new SentimentRepository(); repository.Add(SENTIMENT); repository.Delete(SENTIMENT.Id); Assert.IsTrue(repository.IsEmpty()); }
public void ModifySentimentWord() { string newWord = "Me encanta"; SentimentRepository repository = new SentimentRepository(); repository.Add(SENTIMENT); SENTIMENT.Word = newWord; REPOSITORY.Modify(SENTIMENT.Id, SENTIMENT); Assert.AreEqual(repository.Get(SENTIMENT.Id).Word, newWord); }
public void ModifySentimentType() { string newWord = "Me disgusta"; SentimentType newType = SentimentType.NEGATIVE; SentimentRepository repository = new SentimentRepository(); repository.Add(SENTIMENT); SENTIMENT.Word = newWord; SENTIMENT.Type = newType; REPOSITORY.Modify(SENTIMENT.Id, SENTIMENT); Assert.AreEqual(repository.Get(SENTIMENT.Id).Type, (SentimentType)newType); }
public void GetAllSentimentByType() { Sentiment firstPossitive = new Sentiment(SentimentType.POSITIVE, "i like"); Sentiment secondPositive = new Sentiment(SentimentType.POSITIVE, "i love"); Sentiment negative = new Sentiment(SentimentType.NEGATIVE, "i hate"); SentimentRepository repository = new SentimentRepository(); repository.Add(firstPossitive); repository.Add(secondPositive); repository.Add(negative); IList <Sentiment> positiveRepository = repository.GetBySentimentType(SentimentType.POSITIVE); Assert.IsTrue(positiveRepository.Contains(firstPossitive) && positiveRepository.Contains(secondPositive)); }
private void CleanRepositories() { AuthorAlarmRepository authorAlarmRepository = new AuthorAlarmRepository(); PhraseRepository phraseRepository = new PhraseRepository(); EntityRepository entityRepository = new EntityRepository(); SentimentRepository sentimentRepository = new SentimentRepository(); AuthorRepository authorRepository = new AuthorRepository(); AlarmRepository alarmRepository = new AlarmRepository(); authorAlarmRepository.Clear(); phraseRepository.Clear(); entityRepository.Clear(); sentimentRepository.Clear(); authorRepository.Clear(); alarmRepository.Clear(); }
public void GetAllSentiments() { List <Sentiment> allSentiments = new List <Sentiment>(); Sentiment firstPossitive = new Sentiment(SentimentType.POSITIVE, "i like"); Sentiment secondPositive = new Sentiment(SentimentType.POSITIVE, "i love"); Sentiment negative = new Sentiment(SentimentType.NEGATIVE, "i hate"); SentimentRepository repository = new SentimentRepository(); repository.Add(firstPossitive); repository.Add(secondPositive); repository.Add(negative); allSentiments.Add(firstPossitive); allSentiments.Add(secondPositive); allSentiments.Add(negative); Assert.IsTrue(repository.GetAll().SequenceEqual(allSentiments)); }
public void UpdateAlarmWithOldPhrases() { EntityRepository entityRepository = new EntityRepository(); entityRepository.Add(ALARM.Entity); SentimentRepository sentimentRepository = new SentimentRepository(); sentimentRepository.Add(new Sentiment(SentimentType.POSITIVE, "i like")); AuthorRepository authorRepository = new AuthorRepository(); authorRepository.Add(AUTHOR); PhraseRepository phraseRepository = new PhraseRepository(); phraseRepository.Add(new Phrase($"i like {ALARM.Entity.Name}", DateTime.Now.AddDays(-1), AUTHOR)); REPOSITORY.Add(ALARM); Assert.AreEqual(REPOSITORY.Get(ALARM.Id).PostCount, 1); }
public void UpdateAlarmWithOldPhrases() { SentimentRepository sentimentRepository = new SentimentRepository(); sentimentRepository.Add(new Sentiment(SentimentType.POSITIVE, "i like")); AuthorRepository authorRepository = new AuthorRepository(); authorRepository.Add(AUTHOR); PhraseRepository phraseRepository = new PhraseRepository(); REPOSITORY.Add(ALARM); Phrase phraseTest = new Phrase($"i like Google", DateTime.Now, AUTHOR); try { phraseRepository.Add(phraseTest); } catch (AnalysisException) { } Assert.AreEqual(REPOSITORY.Get(ALARM.Id).PostCount, 1); }
public void DeleteNullSentiment() { SentimentRepository repository = new SentimentRepository(); repository.Delete(null); }
public void DeleteNonExistenceSentiment() { SentimentRepository repository = new SentimentRepository(); repository.Delete(SENTIMENT.Id); }
public void GetNonExitentId() { SentimentRepository repository = new SentimentRepository(); repository.Get(SENTIMENT.Id + 1); }
public void IsEmpty() { SentimentRepository repository = new SentimentRepository(); Assert.IsTrue(repository.IsEmpty()); }