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 ModifySentimentNoUpdateDifferentSentimentTypeAlarm() { PhraseRepository phraseRepository = new PhraseRepository(); EntityRepository entityRepository = new EntityRepository(); AuthorRepository authorRepository = new AuthorRepository(); EntityAlarmRepository alarmRepository = new EntityAlarmRepository(); Phrase phrase = new Phrase("i like google", DateTime.Now, AUTHOR); Entity google = new Entity("google"); Sentiment sentiment = new Sentiment(SentimentType.POSITIVE, "i like"); authorRepository.Add(AUTHOR); try { phraseRepository.Add(phrase); } catch (AnalysisException) { } try { entityRepository.Add(google); } catch (AnalysisException) { } try { phrase.AnalyzePhrase(new List <Entity> { google }, new List <Sentiment> { sentiment }); } catch (AnalysisException) { } try { REPOSITORY.Add(sentiment); } catch (AnalysisException) { } SENTIMENT.Word = "i dont like"; SENTIMENT.Type = SentimentType.NEGATIVE; REPOSITORY.Modify(sentiment.Id, SENTIMENT); EntityAlarm alarm = new EntityAlarm("1", "1", SentimentType.NEGATIVE, google); alarmRepository.Add(alarm); SENTIMENT.Word = "i really like"; REPOSITORY.Modify(sentiment.Id, SENTIMENT); Assert.AreEqual(alarmRepository.Get(alarm.Id).PostCount, 0); }
public void DeleteEntityDeletesAssosiatedAlarm() { EntityAlarmRepository alarmRepository = new EntityAlarmRepository(); Entity entity = new Entity("Uber"); REPOSITORY.Add(entity); EntityAlarm alarm = new EntityAlarm("1", "1", SentimentType.POSITIVE, entity); alarmRepository.Add(alarm); REPOSITORY.Delete(entity.Id); alarmRepository.Get(alarm.Id); }
public void AddSentimentUpdateAlarm() { EntityAlarmRepository alarmRepository = new EntityAlarmRepository(); alarmRepository.Clear(); AuthorRepository authorRepository = new AuthorRepository(); authorRepository.Clear(); PhraseRepository phraseRepository = new PhraseRepository(); phraseRepository.Clear(); EntityRepository entityRepository = new EntityRepository(); entityRepository.Clear(); authorRepository.Add(AUTHOR); Phrase phrase = new Phrase("i like google", DateTime.Now, AUTHOR); Entity google = new Entity("google"); Sentiment sentiment = new Sentiment(SentimentType.POSITIVE, "i like"); try { entityRepository.Add(google); } catch (AnalysisException) { } try { phraseRepository.Add(phrase); } catch (AnalysisException) { } EntityAlarm alarm = new EntityAlarm("1", "1", SentimentType.POSITIVE, google); alarmRepository.Add(alarm); REPOSITORY.Add(sentiment); Assert.AreEqual(alarmRepository.Get(alarm.Id).PostCount, 1); }
public void AddAlarm() { EntityRepository entityRepository = new EntityRepository(); entityRepository.Add(ALARM.Entity); REPOSITORY.Add(ALARM); Assert.IsNotNull(REPOSITORY.Get(ALARM.Id)); }