public void UnretrievedContentItemIsResolvedByUnretrievedProcessor() { const string insertedContentName = "dummyCodename1"; const string message = "Unretrieved item detected"; var insertedObject = GetContentItemObjectElement(insertedContentName); var wrapperWithObject = WrapElementWithDivs(insertedObject); var plainHtml = "<p>Lorem ipsum etc..<a>asdf</a>..</p>"; var input = plainHtml + wrapperWithObject; var processedContentItems = new Dictionary <string, object> { { insertedContentName, new UnretrievedContentItem() } }; var unresolvedContentItemResolver = new UnretrievedItemsMessageReturningResolver(message); var inlineContentItemsProcessor = new InlineContentItemsProcessor(null, unresolvedContentItemResolver); var result = inlineContentItemsProcessor.Process(input, processedContentItems); Assert.Equal(plainHtml + $"<div>{message}</div>", result); }
public void DifferentContentTypesUnretrievedAndContentTypesWithoutResolverAreResolvedCorrectly() { const string insertedImage1CodeName = "image1"; const string insertedImage1Source = "www.images.com/image1.png"; const string insertedImage2CodeName = "image2"; const string insertedDummyItem1CodeName = "item1"; const string insertedDummyItem1Value = "Leadership!"; const string insertedDummyItem2CodeName = "item2"; const string insertedDummyItem3CodeName = "item3"; const string insertedDummyItem3Value = "Unity!"; const string unretrievedItemMessage = "Unretrieved item detected!"; const string defaultResolverMessage = "Type witout resolver detected!"; var insertedImage1 = WrapElementWithDivs(GetContentItemObjectElement(insertedImage1CodeName)); var insertedImage2 = GetContentItemObjectElement(insertedImage2CodeName); var insertedDummyItem1 = GetContentItemObjectElement(insertedDummyItem1CodeName); var insertedDummyItem2 = WrapElementWithDivs(GetContentItemObjectElement(insertedDummyItem2CodeName)); var insertedDummyItem3 = GetContentItemObjectElement(insertedDummyItem3CodeName); var htmlInput = $"Opting out of business line is not a choice. {insertedDummyItem2} A radical, unified, highly-curated and" + $" digitized realignment transfers a touchpoint. As a result, the attackers empower our well-planned" + $" brainstorming spaces. It's not about our evidence-based customer centricity. It's about brandings. {insertedImage1}" + $" The project leader swiftly enhances market practices in the core. In the same time, an elite, siloed," + $" breakthrough generates our value-added cross fertilization.\n" + $"Our pre-plan prioritizes the group.Our top-level, service - oriented, ingenuity leverages knowledge" + $" - based commitments.{insertedDummyItem3} The market thinker dramatically enforces our hands" + $" - on brainstorming spaces.Adaptability and skillset invigorate the game changers. {insertedDummyItem1}" + $" The thought leaders target a teamwork-oriented silo.\n" + $"A documented high quality enables our unique, outside -in and customer-centric tailwinds." + $"It's not about our targets. {insertedImage2} It's about infrastructures."; var expectedOutput = $"Opting out of business line is not a choice. <div>{unretrievedItemMessage}</div> A radical, unified, highly-curated and" + $" digitized realignment transfers a touchpoint. As a result, the attackers empower our well-planned" + $" brainstorming spaces. It's not about our evidence-based customer centricity. It's about brandings. <div>{defaultResolverMessage}</div>" + $" The project leader swiftly enhances market practices in the core. In the same time, an elite, siloed," + $" breakthrough generates our value-added cross fertilization.\n" + $"Our pre-plan prioritizes the group.Our top-level, service - oriented, ingenuity leverages knowledge" + $" - based commitments.<span>{insertedDummyItem3Value}</span> The market thinker dramatically enforces our hands" + $" - on brainstorming spaces.Adaptability and skillset invigorate the game changers. <span>{insertedDummyItem1Value}</span>" + $" The thought leaders target a teamwork-oriented silo.\n" + $"A documented high quality enables our unique, outside -in and customer-centric tailwinds." + $"It's not about our targets. {unretrievedItemMessage} It's about infrastructures."; var processedContentItems = new Dictionary <string, object> { { insertedImage1CodeName, new DummyImageContentItem() { Source = insertedImage1Source } }, { insertedImage2CodeName, new UnretrievedContentItem() }, { insertedDummyItem1CodeName, new DummyProcessedContentItem() { Value = insertedDummyItem1Value } }, { insertedDummyItem2CodeName, new UnretrievedContentItem() }, { insertedDummyItem3CodeName, new DummyProcessedContentItem() { Value = insertedDummyItem3Value } }, }; var unretrievedInlineContentItemsResolver = new UnretrievedItemsMessageReturningResolver(unretrievedItemMessage); var defaultResolver = new MessageReturningResolver(defaultResolverMessage); var inlineContentItemsProcessor = new InlineContentItemsProcessor(defaultResolver, unretrievedInlineContentItemsResolver); inlineContentItemsProcessor.RegisterTypeResolver(new ResolverReturningElement()); var result = inlineContentItemsProcessor.Process(htmlInput, processedContentItems); Assert.Equal(expectedOutput, result); }