Exemplo n.º 1
0
        public void TestCreateTag_ReturnsCorrectTag_WithSentenceContainingTagWithIdentifier(
            String tagString,
            String expectedSanitisedTagString,
            Int32 expectedIdentifier,
            Boolean expectedIsForHashtag,
            Boolean expectedIsMandatory)
        {
            var tag = new TagFactory().CreateTag(tagString);

            Assert.Equal(expectedSanitisedTagString, tag.TagString.Sanitised);
            Assert.Equal(expectedIdentifier, tag.Identifier);
            Assert.Equal(expectedIsForHashtag, tag.IsForHashtag);
            Assert.Equal(expectedIsMandatory, tag.IsForMandatoryWord);
        }
Exemplo n.º 2
0
        public void TestCreateTag_ReturnsCorrectSuitabilityPredicate()
        {
            var factory = new TagFactory();
            var word    = factory.CreateTag("[#doing]");

            var words =
                new Word[]
            {
                new MockWord(isSuitableForHashtag: false),
                new MockWord(isSuitableForHashtag: true)
            };

            var includedWords =
                words.Where(word.IsSuitable);

            Assert.True(includedWords.All(w => w.IsSuitableForHashtag));
        }