예제 #1
0
        public void GetSubEntitiesFormat_should_return_rawtext_if_entity_has_no_sub_entities()
        {
            const string rawText = "Some raw text";
            var testEnity = new TestEntity(rawText);
            var formatter = new TestFormatter();

            var result = testEnity.GetSubEntitiesFormat(formatter);
            Assert.AreEqual(rawText, result);
        }
예제 #2
0
        public void GetSubEntitiesFormat_should_return_formatted_text_if_entity_has_sub_entities()
        {
            const string rawText = "Some raw text";
            const string correctAnswer = "<test>Some</test><test>raw</test><test>text</test>";
            var formatter = new TestFormatter();
            var subEntities = rawText
                    .Split(' ')
                    .Select(str => (Entity)new TestEntity(str))
                    .ToList();
            var testEnity = new TestEntity(subEntities);

            var result = testEnity.GetSubEntitiesFormat(formatter);
            Assert.AreEqual(correctAnswer, result);
        }