private void AddPhraseUI()
        {
            string   phraseText = textBoxPhrase.Text;
            DateTime phraseDate = dateTimePickerPhraseDate.Value;

            if (dateTimePickerPhraseDate.Value == null)
            {
                labelError.Visible = true;
                labelError.Text    = "Debe seleccionar la fecha de la frase";
            }

            if (listBoxAuthors.SelectedIndex == -1)
            {
                labelError.Visible = true;
                labelError.Text    = "Error seleccione un autor para la frase";
            }
            else
            {
                Phrase phrase = new Phrase()
                {
                    TextPhrase   = phraseText,
                    PhraseDate   = phraseDate,
                    PhraseAuthor = (Author)listBoxAuthors.SelectedItem
                };
                generalManagement.PhraseManagement.AddPhrase(phrase);
                generalManagement.AnalysisPhrase(phrase);
                RealTimeProvider timeNow = new RealTimeProvider();
                generalManagement.UpdateAlarms(timeNow);
                MessageBox.Show("Se ha agregado una frase correctamente");
                ClearAllFields();
            }
        }
Exemplo n.º 2
0
        public void AnalysisOfPhrasePositive()
        {
            management.AuthorManagement.AddAuthor(author);
            Entity entityExpected = new Entity()
            {
                EntityName = "Coca Cola"
            };

            management.EntityManagement.AddEntity(entityExpected);
            Sentiment sentiment = new Sentiment()
            {
                SentimientText = "Me gusta",
                SentimentType  = Sentiment.TypeSentiment.Positive
            };

            management.SentimentManagement.AddSentiment(sentiment);
            Phrase phrase = new Phrase()
            {
                TextPhrase   = "Me gusta Coca Cola",
                PhraseAuthor = author,
                PhraseDate   = DateTime.Now
            };

            management.PhraseManagement.AddPhrase(phrase);
            management.AnalysisPhrase(phrase);
            Phrase expectedPhrase = new Phrase()
            {
                TextPhrase   = "Me gusta Coca Cola",
                PhraseDate   = DateTime.Now,
                Entity       = entityExpected,
                PhraseType   = Phrase.TypePhrase.Positive,
                PhraseAuthor = author
            };

            Assert.AreEqual(expectedPhrase, phrase);
        }