diff --git a/services/catalog/test/EShopOnAbp.CatalogService.Domain.Tests/CatalogServiceDomainCollection.cs b/services/catalog/test/EShopOnAbp.CatalogService.Domain.Tests/CatalogServiceDomainCollection.cs
new file mode 100644
index 00000000..b0d3e0d8
--- /dev/null
+++ b/services/catalog/test/EShopOnAbp.CatalogService.Domain.Tests/CatalogServiceDomainCollection.cs
@@ -0,0 +1,10 @@
+using EShopOnAbp.CatalogService.MongoDB;
+using Xunit;
+
+namespace EShopOnAbp.CatalogService;
+
+[CollectionDefinition(CatalogServiceTestConsts.CollectionDefinitionName)]
+public class CatalogServiceDomainCollection : CatalogServiceMongoDbCollectionFixtureBase
+{
+
+}
\ No newline at end of file
diff --git a/services/catalog/test/EShopOnAbp.CatalogService.Domain.Tests/CatalogServiceDomainTestModule.cs b/services/catalog/test/EShopOnAbp.CatalogService.Domain.Tests/CatalogServiceDomainTestModule.cs
index 65b5ea71..512d80ed 100644
--- a/services/catalog/test/EShopOnAbp.CatalogService.Domain.Tests/CatalogServiceDomainTestModule.cs
+++ b/services/catalog/test/EShopOnAbp.CatalogService.Domain.Tests/CatalogServiceDomainTestModule.cs
@@ -1,10 +1,10 @@
-using EShopOnAbp.CatalogService.EntityFrameworkCore;
+using EShopOnAbp.CatalogService.MongoDB;
using Volo.Abp.Modularity;
namespace EShopOnAbp.CatalogService
{
[DependsOn(
- typeof(CatalogServiceEntityFrameworkCoreTestModule)
+ typeof(CatalogServiceMongoDbTestModule)
)]
public class CatalogServiceDomainTestModule : AbpModule
{
diff --git a/services/catalog/test/EShopOnAbp.CatalogService.Domain.Tests/EShopOnAbp.CatalogService.Domain.Tests.csproj b/services/catalog/test/EShopOnAbp.CatalogService.Domain.Tests/EShopOnAbp.CatalogService.Domain.Tests.csproj
index 96db1145..76ffe1aa 100644
--- a/services/catalog/test/EShopOnAbp.CatalogService.Domain.Tests/EShopOnAbp.CatalogService.Domain.Tests.csproj
+++ b/services/catalog/test/EShopOnAbp.CatalogService.Domain.Tests/EShopOnAbp.CatalogService.Domain.Tests.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/EShopOnAbp.CatalogService.MongoDB.Tests.csproj b/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/EShopOnAbp.CatalogService.MongoDB.Tests.csproj
new file mode 100644
index 00000000..2a7099e4
--- /dev/null
+++ b/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/EShopOnAbp.CatalogService.MongoDB.Tests.csproj
@@ -0,0 +1,17 @@
+
+
+
+
+
+ net6.0
+ EShopOnAbp.CatalogService
+
+
+
+
+
+
+
+
+
+
diff --git a/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoCollection.cs b/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoCollection.cs
new file mode 100644
index 00000000..9da3075f
--- /dev/null
+++ b/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoCollection.cs
@@ -0,0 +1,9 @@
+using Xunit;
+
+namespace EShopOnAbp.CatalogService.MongoDB;
+
+[CollectionDefinition(CatalogServiceTestConsts.CollectionDefinitionName)]
+public class CatalogServiceMongoCollection : CatalogServiceMongoDbCollectionFixtureBase
+{
+
+}
\ No newline at end of file
diff --git a/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoDbCollectionFixtureBase.cs b/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoDbCollectionFixtureBase.cs
new file mode 100644
index 00000000..717b31ad
--- /dev/null
+++ b/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoDbCollectionFixtureBase.cs
@@ -0,0 +1,8 @@
+using Xunit;
+
+namespace EShopOnAbp.CatalogService.MongoDB;
+
+public class CatalogServiceMongoDbCollectionFixtureBase : ICollectionFixture
+{
+
+}
\ No newline at end of file
diff --git a/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoDbFixture.cs b/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoDbFixture.cs
new file mode 100644
index 00000000..25e51904
--- /dev/null
+++ b/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoDbFixture.cs
@@ -0,0 +1,22 @@
+using System;
+using Mongo2Go;
+
+namespace EShopOnAbp.CatalogService.MongoDB
+{
+ public class CatalogServiceMongoDbFixture : IDisposable
+ {
+ private static readonly MongoDbRunner MongoDbRunner;
+ public static readonly string ConnectionString;
+
+ static CatalogServiceMongoDbFixture()
+ {
+ MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
+ ConnectionString = MongoDbRunner.ConnectionString;
+ }
+
+ public void Dispose()
+ {
+ MongoDbRunner?.Dispose();
+ }
+ }
+}
diff --git a/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoDbTestBase.cs b/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoDbTestBase.cs
new file mode 100644
index 00000000..b5a2dbf9
--- /dev/null
+++ b/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoDbTestBase.cs
@@ -0,0 +1,10 @@
+namespace EShopOnAbp.CatalogService.MongoDB
+{
+ /* This class can be used as a base class for MongoDB integration tests,
+ * while SampleRepository_Tests uses a different approach.
+ */
+ public abstract class CatalogServiceMongoDbTestBase : CatalogServiceTestBase
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoDbTestModule.cs b/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoDbTestModule.cs
new file mode 100644
index 00000000..cd09e671
--- /dev/null
+++ b/services/catalog/test/EShopOnAbp.CatalogService.MongoDB.Tests/MongoDB/CatalogServiceMongoDbTestModule.cs
@@ -0,0 +1,27 @@
+using System;
+using Volo.Abp.Data;
+using Volo.Abp.Modularity;
+using Volo.Abp.Uow;
+
+namespace EShopOnAbp.CatalogService.MongoDB
+{
+ [DependsOn(
+ typeof(CatalogServiceTestBaseModule),
+ typeof(CatalogServiceMongoDbModule)
+ )]
+ public class CatalogServiceMongoDbTestModule : AbpModule
+ {
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ var stringArray = CatalogServiceMongoDbFixture.ConnectionString.Split('?');
+ var connectionString = stringArray[0].EnsureEndsWith('/') +
+ "Db_" +
+ Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
+
+ Configure(options =>
+ {
+ options.ConnectionStrings.Default = connectionString;
+ });
+ }
+ }
+}
diff --git a/services/catalog/test/EShopOnAbp.CatalogService.TestBase/CatalogServiceTestConsts.cs b/services/catalog/test/EShopOnAbp.CatalogService.TestBase/CatalogServiceTestConsts.cs
new file mode 100644
index 00000000..ca8e26ab
--- /dev/null
+++ b/services/catalog/test/EShopOnAbp.CatalogService.TestBase/CatalogServiceTestConsts.cs
@@ -0,0 +1,6 @@
+namespace EShopOnAbp.CatalogService;
+
+public static class CatalogServiceTestConsts
+{
+ public const string CollectionDefinitionName = "CatalogService collection";
+}
\ No newline at end of file