コード例 #1
0
        public void StrongTagType_IsOpenedTag_ReturnRightDefinesDoubleOpenedTags(string text, int expectedCount)
        {
            var strong         = new StrongTagType();
            var underlineCount = text.Where((t, i) => strong.IsOpenedTag(text, i)).Count();

            underlineCount.Should().Be(expectedCount);
        }
コード例 #2
0
ファイル: TagType.cs プロジェクト: mnenorm74/clean-code
        public static TagType GetTagType(string text, int position)
        {
            var em     = new EmTagType();
            var strong = new StrongTagType();

            if (em.IsOpenedTag(text, position) || em.IsClosedTag(text, position))
            {
                return(em);
            }
            if (strong.IsOpenedTag(text, position) || strong.IsClosedTag(text, position))
            {
                return(strong);
            }
            return(new DefaultTagType());
        }
コード例 #3
0
        public void StrongTagType_IsOpenedTag_ReturnRightResult(string text, int position, bool expected)
        {
            var strong = new StrongTagType();

            strong.IsOpenedTag(text, position).Should().Be(expected);
        }