Browse Source

Moved unit test to app layer

pull/13082/head
malik masis 4 years ago
parent
commit
0fc407f723
  1. 34
      modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentParser_Test.cs

34
modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Polls/PollViewComponentManager_Test.cs → modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentParser_Test.cs

@ -2,22 +2,23 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Shouldly; using Shouldly;
using Volo.CmsKit.Polls;
using Xunit; using Xunit;
namespace Volo.CmsKit.Polls; namespace Volo.CmsKit.Contents;
public class ContentParser_Test : CmsKitDomainTestBase
public class PollViewComponentManager_Test : CmsKitDomainTestBase
{ {
private readonly CmsKitTestData testData; private readonly CmsKitTestData testData;
private readonly IOptions<CmsKitContentWidgetOptions> _options; private readonly IOptions<CmsKitContentWidgetOptions> _options;
private readonly ContentParser contentParser;
public PollViewComponentManager_Test() public ContentParser_Test()
{ {
testData = GetRequiredService<CmsKitTestData>(); testData = GetRequiredService<CmsKitTestData>();
_options = GetRequiredService<IOptions<CmsKitContentWidgetOptions>>(); _options = GetRequiredService<IOptions<CmsKitContentWidgetOptions>>();
contentParser = GetRequiredService<ContentParser>();
} }
/* TODO: Enable again
[Fact] [Fact]
public async Task AA_ParseAsync_ShouldWorkMoreDynamically() public async Task AA_ParseAsync_ShouldWorkMoreDynamically()
{ {
@ -29,10 +30,10 @@ public class PollViewComponentManager_Test : CmsKitDomainTestBase
Thanks _for_ *your * feedback. Thanks _for_ *your * feedback.
[Widget Type=""ImageGallery"" GalleryName=""Xyz"" Source=""GoogleDrive""]"; [Widget Type=""ImageGallery"" GalleryName=""Xyz"" Source=""GoogleDrive""]";
var poll = await pollManager.ParseAsync(content); var widgets = await contentParser.ParseAsync(content);
poll.ShouldNotBeNull(); widgets.ShouldNotBeNull();
poll.Count.ShouldBe(4); widgets.Count.ShouldBe(4);
} }
[Fact] [Fact]
@ -42,7 +43,7 @@ public class PollViewComponentManager_Test : CmsKitDomainTestBase
[Widget Type= ""Poll"" PollName =""poll-name""] [Widget Type= ""Poll"" PollName =""poll-name""]
Thanks _for_ *your * feedback."; Thanks _for_ *your * feedback.";
var poll = await pollManager.ParseAsync(content); var poll = await contentParser.ParseAsync(content);
poll.ShouldNotBeNull(); poll.ShouldNotBeNull();
poll.Count.ShouldBe(1);//Ignored Widget poll.Count.ShouldBe(1);//Ignored Widget
@ -57,7 +58,7 @@ public class PollViewComponentManager_Test : CmsKitDomainTestBase
[Widget Type= ""Poll"" PollName =""poll-name""] [Widget Type= ""Poll"" PollName =""poll-name""]
Thanks _for_ *your * feedback."; Thanks _for_ *your * feedback.";
var poll = await pollManager.ParseAsync(content); var poll = await contentParser.ParseAsync(content);
poll.ShouldNotBeNull(); poll.ShouldNotBeNull();
poll.Count.ShouldBe(2); poll.Count.ShouldBe(2);
@ -72,7 +73,7 @@ public class PollViewComponentManager_Test : CmsKitDomainTestBase
[Widget Wrong Type= ""Poll"" PollName =""poll-name""] [Widget Wrong Type= ""Poll"" PollName =""poll-name""]
Thanks _for_ *your * feedback."; Thanks _for_ *your * feedback.";
var poll = await pollManager.ParseAsync(content); var poll = await contentParser.ParseAsync(content);
poll.ShouldNotBeNull(); poll.ShouldNotBeNull();
poll.Count.ShouldBe(2); poll.Count.ShouldBe(2);
@ -87,7 +88,7 @@ public class PollViewComponentManager_Test : CmsKitDomainTestBase
[Widget Type= ""Poll"" PollWrongName =""poll-name""] [Widget Type= ""Poll"" PollWrongName =""poll-name""]
Thanks _for_ *your * feedback."; Thanks _for_ *your * feedback.";
var poll = await pollManager.ParseAsync(content); var poll = await contentParser.ParseAsync(content);
poll.ShouldNotBeNull(); poll.ShouldNotBeNull();
poll.Count.ShouldBe(2); poll.Count.ShouldBe(2);
@ -99,7 +100,7 @@ public class PollViewComponentManager_Test : CmsKitDomainTestBase
{ {
_options.Value.AddWidgetConfig(testData.PollName, new ContentWidgetConfig(testData.WidgetName)); _options.Value.AddWidgetConfig(testData.PollName, new ContentWidgetConfig(testData.WidgetName));
var poll = await pollManager.ParseAsync(content); var poll = await contentParser.ParseAsync(content);
poll.ShouldNotBeNull(); poll.ShouldNotBeNull();
poll.Count.ShouldBe(expectedLine); poll.Count.ShouldBe(expectedLine);
@ -128,11 +129,4 @@ public class PollViewComponentManager_Test : CmsKitDomainTestBase
new object[] { @"Thanks _for_ *your * feedback. new object[] { @"Thanks _for_ *your * feedback.
Thanks _for_ *your * feedback.", 1} Thanks _for_ *your * feedback.", 1}
}; };
*/
} }
Loading…
Cancel
Save