public void VerifyAlarms3() { management.AuthorManagement.AddAuthor(author); Entity entity = new Entity() { EntityName = "Coca Cola" }; management.EntityManagement.AddEntity(entity); EntityAlarm aAlarm = new EntityAlarm() { Entity = entity, TypeOfAlarm = EntityAlarm.Type.Positive, QuantityPost = 1, QuantityTime = 1, IsInHours = false }; management.AlarmManagement.AddAlarm(aAlarm); MockedTimeProvider provider = new MockedTimeProvider() { MockedDateTime = new DateTime(2020, 04, 30, 19, 10, 30) }; management.UpdateAlarms(provider); Assert.IsFalse(aAlarm.IsActive); }
public void VerifyAlarmsOfAuthors2() { management.AuthorManagement.AddAuthor(author); Entity entity = new Entity() { EntityName = "Coca Cola" }; Entity entity2 = new Entity() { EntityName = "Pepsi" }; management.EntityManagement.AddEntity(entity); management.EntityManagement.AddEntity(entity2); Sentiment sentiment = new Sentiment() { SentimientText = "Me gusta", SentimentType = Sentiment.TypeSentiment.Positive }; management.SentimentManagement.AddSentiment(sentiment); AuthorAlarm aAlarm = new AuthorAlarm() { TypeOfAlarm = AuthorAlarm.TypeOfNewAlarm.Positive, QuantityPost = 1, QuantityTime = 1, IsInHours = false }; management.AlarmManagement.AddAlarm(aAlarm); Phrase phrase = new Phrase() { TextPhrase = "Me gusta Coca Cola", PhraseDate = new DateTime(2020, 04, 28), Entity = entity, PhraseType = Phrase.TypePhrase.Positive, PhraseAuthor = author }; Phrase phrase2 = new Phrase() { TextPhrase = "Me gusta Pepsi", PhraseDate = new DateTime(2020, 04, 25), Entity = entity2, PhraseType = Phrase.TypePhrase.Positive, PhraseAuthor = author }; management.PhraseManagement.AddPhrase(phrase); management.PhraseManagement.AddPhrase(phrase2); MockedTimeProvider provider = new MockedTimeProvider() { MockedDateTime = new DateTime(2020, 04, 30, 19, 10, 30) }; management.UpdateAlarms(provider); Assert.IsFalse(aAlarm.IsActive); CollectionAssert.DoesNotContain(aAlarm.ParticipantsAuthors, author); }
public void VerifyAlarms4() { management.AuthorManagement.AddAuthor(author); Entity entity = new Entity() { EntityName = "Coca Cola" }; Entity entity2 = new Entity() { EntityName = "Pepsi" }; management.EntityManagement.AddEntity(entity); management.EntityManagement.AddEntity(entity2); Sentiment sentiment = new Sentiment() { SentimientText = "Me gusta", SentimentType = Sentiment.TypeSentiment.Positive }; management.SentimentManagement.AddSentiment(sentiment); EntityAlarm aAlarm = new EntityAlarm() { Entity = entity, TypeOfAlarm = EntityAlarm.Type.Positive, QuantityPost = 1, QuantityTime = 2, IsInHours = false }; management.AlarmManagement.AddAlarm(aAlarm); Phrase phrase = new Phrase() { TextPhrase = "Me gusta Coca Cola", PhraseDate = new DateTime(2020, 04, 25), Entity = entity, PhraseType = Phrase.TypePhrase.Positive, PhraseAuthor = author }; Phrase phrase2 = new Phrase() { TextPhrase = "Me gusta Pepsi", PhraseDate = new DateTime(2020, 04, 26), Entity = entity2, PhraseType = Phrase.TypePhrase.Positive, PhraseAuthor = author }; management.PhraseManagement.AddPhrase(phrase); management.PhraseManagement.AddPhrase(phrase2); MockedTimeProvider provider = new MockedTimeProvider() { MockedDateTime = new DateTime(2020, 04, 26, 19, 10, 30) }; management.UpdateAlarms(provider); Assert.IsTrue(management.AlarmManagement.GetEntityAlarm(aAlarm).IsActive); }
public void ShowActiveAlarm() { management.AuthorManagement.AddAuthor(author); management.AuthorManagement.AddAuthor(author2); AuthorAlarm aAlarm = new AuthorAlarm() { TypeOfAlarm = AuthorAlarm.TypeOfNewAlarm.Positive, QuantityPost = 1, QuantityTime = 1, IsInHours = false }; management.AlarmManagement.AddAlarm(aAlarm); Entity entity = new Entity() { EntityName = "Coca Cola" }; management.EntityManagement.AddEntity(entity); Sentiment sentiment = new Sentiment() { SentimientText = "Me gusta", SentimentType = Sentiment.TypeSentiment.Positive }; management.SentimentManagement.AddSentiment(sentiment); Phrase phrase = new Phrase() { TextPhrase = "Me gusta Coca Cola", PhraseDate = new DateTime(2020, 04, 30), Entity = entity, PhraseType = Phrase.TypePhrase.Positive, PhraseAuthor = author }; Phrase phrase2 = new Phrase() { TextPhrase = "Me gusta Coca Cola", PhraseDate = new DateTime(2020, 04, 30), Entity = entity, PhraseType = Phrase.TypePhrase.Positive, PhraseAuthor = author2 }; management.PhraseManagement.AddPhrase(phrase); management.PhraseManagement.AddPhrase(phrase2); MockedTimeProvider provider = new MockedTimeProvider() { MockedDateTime = new DateTime(2020, 04, 30, 19, 10, 30) }; management.UpdateAlarms(provider); string resultExpected = "Alarma de tipo: " + "positiva" + " con estado: " + "activa" + " con los autores: " + " " + "Josami" + " " + "agustinh "; Assert.AreEqual(resultExpected, management.AlarmManagement.GetAuthorAlarm(aAlarm).Show()); }
public void VerifyUpdateSentiment() { management.AuthorManagement.AddAuthor(author); management.AuthorManagement.AddAuthor(author2); Entity entity = new Entity() { EntityName = "Coca Cola" }; Entity entity2 = new Entity() { EntityName = "Pepsi" }; management.EntityManagement.AddEntity(entity); management.EntityManagement.AddEntity(entity2); Sentiment sentiment = new Sentiment() { SentimientText = "Me gusta", SentimentType = Sentiment.TypeSentiment.Positive }; management.SentimentManagement.AddSentiment(sentiment); Phrase phrase = new Phrase() { TextPhrase = "Me gusta Coca Cola", PhraseDate = new DateTime(2020, 04, 25), Entity = entity, PhraseType = Phrase.TypePhrase.Positive, PhraseAuthor = author }; Phrase phrase2 = new Phrase() { TextPhrase = "Me gusta Pepsi", PhraseDate = new DateTime(2020, 04, 30), Entity = entity2, PhraseType = Phrase.TypePhrase.Positive, PhraseAuthor = author2 }; management.PhraseManagement.AddPhrase(phrase); management.PhraseManagement.AddPhrase(phrase2); management.AnalysisPhrase(phrase); management.AnalysisPhrase(phrase2); MockedTimeProvider provider = new MockedTimeProvider() { MockedDateTime = new DateTime(2020, 04, 30, 19, 10, 30) }; management.AuthorManagement.DeleteAuthor(author); management.SentimentManagement.UpdateSentiments(management.PhraseManagement.AllPhrases); Assert.IsFalse(sentiment.IsAssociatedToPhrase); }
public void VerifyAlarmsOfAuthors() { management.AuthorManagement.AddAuthor(author); Entity entity = new Entity() { EntityName = "Coca Cola" }; management.EntityManagement.AddEntity(entity); Sentiment sentiment = new Sentiment() { SentimientText = "Me gusta", SentimentType = Sentiment.TypeSentiment.Positive }; management.SentimentManagement.AddSentiment(sentiment); AuthorAlarm aAlarm = new AuthorAlarm() { TypeOfAlarm = AuthorAlarm.TypeOfNewAlarm.Positive, QuantityPost = 1, QuantityTime = 1, IsInHours = true }; management.AlarmManagement.AddAlarm(aAlarm); Phrase phrase = new Phrase() { TextPhrase = "Me gusta Coca Cola", PhraseDate = DateTime.Now, Entity = entity, PhraseType = Phrase.TypePhrase.Positive, PhraseAuthor = author }; management.PhraseManagement.AddPhrase(phrase); MockedTimeProvider provider = new MockedTimeProvider() { MockedDateTime = new DateTime(2019, 10, 1, 19, 10, 30) }; management.UpdateAlarms(provider); AuthorAlarm dbAlarm = management.AlarmManagement.GetAuthorAlarm(aAlarm); Assert.IsTrue(dbAlarm.IsActive); CollectionAssert.Contains(dbAlarm.ParticipantsAuthors, author); }
public void VerifyAlarms7() { management.AuthorManagement.AddAuthor(author); Entity entity = new Entity() { EntityName = "Coca Cola" }; management.EntityManagement.AddEntity(entity); Sentiment sentiment = new Sentiment() { SentimientText = "Odio", SentimentType = Sentiment.TypeSentiment.Negative }; management.SentimentManagement.AddSentiment(sentiment); EntityAlarm aAlarm = new EntityAlarm() { Entity = entity, TypeOfAlarm = EntityAlarm.Type.Positive, QuantityPost = 1, QuantityTime = 1, IsInHours = false }; management.AlarmManagement.AddAlarm(aAlarm); Phrase phrase = new Phrase() { TextPhrase = "Odio Coca Cola", PhraseDate = new DateTime(2020, 02, 10), Entity = entity, PhraseType = Phrase.TypePhrase.Negative, PhraseAuthor = author }; management.PhraseManagement.AddPhrase(phrase); MockedTimeProvider provider = new MockedTimeProvider() { MockedDateTime = new DateTime(2020, 02, 10, 19, 10, 30) }; management.UpdateAlarms(provider); Assert.IsFalse(aAlarm.IsActive); }
public void VerifyAlarmsAuthorsAlarms() { management.AuthorManagement.AddAuthor(author); AuthorAlarm aAlarm = new AuthorAlarm() { TypeOfAlarm = AuthorAlarm.TypeOfNewAlarm.Positive, QuantityPost = 1, QuantityTime = 1, IsInHours = false }; management.AlarmManagement.AddAlarm(aAlarm); MockedTimeProvider provider = new MockedTimeProvider() { MockedDateTime = new DateTime(2020, 04, 30, 19, 10, 30) }; management.UpdateAlarms(provider); Assert.IsFalse(aAlarm.IsActive); CollectionAssert.DoesNotContain(aAlarm.ParticipantsAuthors, author); }