public async Task ParseAsync_ShouldWorkProperlyWithCorrectInputs(string content, int expectedLine) { _options.Value.AddWidget(testData.PollName, testData.WidgetName); contentParser = new ContentParser(_options); var widgets = await contentParser.ParseAsync(content); widgets.ShouldNotBeNull(); widgets.Count.ShouldBe(expectedLine); }
public async Task ParseAsync_ShouldWorkWithoutConfigOptions() { var content = @"**ABP Framework** is completely open source and developed in a community-driven manner. [Widget Type= ""Poll"" Code =""poll-name""] Thanks _for_ *your * feedback."; contentParser = new ContentParser(_options); var widgets = await contentParser.ParseAsync(content); widgets.ShouldNotBeNull(); widgets.Count.ShouldBe(1);//Ignored Widget }
public async Task ParseAsync_ShouldWorkWithWrongPollName() { _options.Value.AddWidget(testData.PollName, testData.WidgetName); contentParser = new ContentParser(_options); var content = @"**ABP Framework** is completely open source and developed in a community-driven manner. [Widget Type= ""Poll"" PollWrongName =""poll-name""] Thanks _for_ *your * feedback."; var widgets = await contentParser.ParseAsync(content); widgets.ShouldNotBeNull(); widgets.Count.ShouldBe(3); }
public async Task ParseAsync_ShouldWorkWithDifferentWidgetTypes() { _options.Value.AddWidget(testData.PollName, testData.WidgetName); _options.Value.AddWidget("ImageGallery", "ImageGallery"); contentParser = new ContentParser(_options); var content = @"**ABP Framework** is completely open source and developed in a community-driven manner. [Widget Type=""Poll"" Code=""poll-name""] Thanks _for_ *your * feedback. [Widget GalleryName=""Xyz"" Type=""ImageGallery"" Source=""GoogleDrive""]"; var widgets = await contentParser.ParseAsync(content); widgets.ShouldNotBeNull(); widgets.Count.ShouldBe(4); widgets[1].ExtraProperties.Count.ShouldBe(2); widgets[3].ExtraProperties.Count.ShouldBe(3); }