Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Add Grand.Domain.Tests

supported6012b62b29
diff --git a/src/Tests/Grand.Domain.Tests/Blogs/BlogExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Blogs/BlogExtensionsTests.cs
new file mode 100644
index 000000000..571d99d75
--- /dev/null
+++ b/src/Tests/Grand.Domain.Tests/Blogs/BlogExtensionsTests.cs
@@ -0,0 +1,29 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace Grand.Domain.Blogs.Tests
+{
+ [TestClass()]
+ public class BlogExtensionsTests
+ {
+ [TestMethod()]
+ public void ParseTagsTest()
+ {
+ var blogPost = new BlogPost() {
+ Tags = "e-commerce, blog, moey"
+ };
+
+ Assert.AreEqual(3, blogPost.ParseTags().Count());
+ }
+
+ [TestMethod()]
+ public void GetPostsByDateTest()
+ {
+ var blogPosts = new List<BlogPost>() {
+ new BlogPost(){ StartDateUtc = new DateTime(2010,01,01) },
+ new BlogPost(){ StartDateUtc = new DateTime(2010,02,01) },
+ new BlogPost(){ StartDateUtc = new DateTime(2010,03,01) },
+ };
+ Assert.AreEqual(2, blogPosts.GetPostsByDate(new DateTime(2010, 01, 01), new DateTime(2010, 02, 28)).Count());
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Tests/Grand.Domain.Tests/Grand.Domain.Tests.csproj b/src/Tests/Grand.Domain.Tests/Grand.Domain.Tests.csproj
new file mode 100644
index 000000000..816de8f09
--- /dev/null
+++ b/src/Tests/Grand.Domain.Tests/Grand.Domain.Tests.csproj
@@ -0,0 +1,24 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <Import Project="..\..\Build\Grand.Common.props" />
+ <PropertyGroup>
+ <IsPackable>false</IsPackable>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
+ <PackageReference Include="Moq" Version="4.18.2" />
+ <PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
+ <PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
+ <PackageReference Include="coverlet.collector" Version="3.1.2">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+ </PackageReference>
+ <PackageReference Include="NUnit" Version="3.13.3" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\..\Core\Grand.Domain\Grand.Domain.csproj" />
+ <ProjectReference Include="..\..\Core\Grand.SharedKernel\Grand.SharedKernel.csproj" />
+ </ItemGroup>
+
+</Project>