Esempio n. 1
0
        public int WordCount_reflects_correct_count_cases(string text)
        {
            var entityUnderTest = DreamEntryViewModel.ForNewDream();

            entityUnderTest.DreamText = text;
            return(entityUnderTest.WordCount);
        }
Esempio n. 2
0
        public bool HasNoTextOrTags_for_cases(string text, string tags)
        {
            var entityUnderTest = DreamEntryViewModel.ForNewDream();

            entityUnderTest.DreamText = text;
            entityUnderTest.Tags      = tags;
            return(entityUnderTest.HasTextOrTags);
        }
Esempio n. 3
0
        public void Tags_changed_notifies_PropertyChanged()
        {
            var tagFired        = false;
            var entityUnderTest = DreamEntryViewModel.ForNewDream();

            entityUnderTest.PropertyChanged += (s, e) => tagFired |= e.PropertyName == nameof(entityUnderTest.Tags);
            entityUnderTest.Tags             = "FRIEND";
            tagFired.Should().BeTrue();
        }
Esempio n. 4
0
        public void ToDreamEntry_copies_data()
        {
            var entityUnderTest = DreamEntryViewModel.ForNewDream();

            entityUnderTest.DreamDate = new DateTime(2019, 2, 20);
            entityUnderTest.Tags      = "Friends, Beach (Gandía)";
            entityUnderTest.DreamText = "Hello there. General Kenobi";

            var entry = entityUnderTest.ToDreamEntry();

            entry.Date.Should().Be(new DateTime(2019, 2, 20));
            entry.Text.Should().Be("Hello there. General Kenobi");
            entry.GetTagString().Should().Be("Friends, Beach (Gandía)");
        }
Esempio n. 5
0
        public void DreamText_when_changed_fires_PropertyChanged_for_DreamText_and_WordCount_and_WordCountDisplay()
        {
            var dreamTextFired        = false;
            var wordCountFired        = false;
            var wordCountDisplayFired = false;
            var entityUnderTest       = DreamEntryViewModel.ForNewDream();

            entityUnderTest.PropertyChanged += (s, e) =>
            {
                dreamTextFired        |= e.PropertyName == nameof(entityUnderTest.DreamText);
                wordCountFired        |= e.PropertyName == nameof(entityUnderTest.WordCount);
                wordCountDisplayFired |= e.PropertyName == nameof(entityUnderTest.WordCountDisplay);
            };

            entityUnderTest.DreamText = "ABC";

            dreamTextFired.Should().BeTrue();
            wordCountFired.Should().BeTrue();
            wordCountDisplayFired.Should().BeTrue();
        }
Esempio n. 6
0
        public void ForNewDream_date_is_initialized_to_today()
        {
            var entityUnderTest = DreamEntryViewModel.ForNewDream();

            entityUnderTest.DreamDate.Should().Be(DateTime.Now.Date);
        }