public void ParseNone()
        {
            const string text = "This text does not contain any HashTags.";

            var hashTags = HashTag.Parse(text).ToArray();
            var length   = hashTags.Length;

            Assert.Equal(0, length);
        }
        public void ParseSingle()
        {
            const string text = "This text contains a #Single HashTag.";

            var hashTags = HashTag.Parse(text).ToArray();
            var length   = hashTags.Length;

            Assert.Equal(1, length);
            Assert.Equal("Single", hashTags[0].Id);
        }
        public void ParseMultiple()
        {
            const string text = "This text contains #Multiple #HashTags!.";

            var hashTags = HashTag.Parse(text).ToArray();
            var length   = hashTags.Length;

            Assert.Equal(2, length);
            Assert.Equal("Multiple", hashTags[0].Id);
            Assert.Equal("HashTags", hashTags[1].Id);
        }
Example #4
0
        public void Update(string title, string content)
        {
            Title   = title;
            Content = content;

            _hashTags.Clear();

            foreach (var hashTag in HashTag.Parse(content))
            {
                _hashTags.Add(hashTag);
            }
        }
Example #5
0
        public Article(string title, string content)
        {
            Title   = title;
            Content = content;

            foreach (var hashTag in HashTag.Parse(content))
            {
                _hashTags.Add(hashTag);
            }

            AddDomainEvent(new ArticleCreatedEvent(Title, HashTags.Select(ht => ht.Id)));
        }