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.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
using Grand.Business.Core.Queries.Messages;
using Grand.Business.Messages.Queries.Handlers;
using Grand.Data.Tests.MongoDb;
using Grand.Domain.Catalog;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Grand.Business.Messages.Tests.Queries.Handlers;
[TestClass]
public class GetProductByIdQueryHandlerTests
{
private GetProductByIdQueryHandler handler;
[TestInitialize]
public void Init()
{
var _repository = new MongoDBRepositoryTest<Product>();
_repository.Insert(new Product { Id = "1" });
_repository.Insert(new Product());
_repository.Insert(new Product());
_repository.Insert(new Product());
handler = new GetProductByIdQueryHandler(_repository);
}
[TestMethod]
public async Task HandleTest()
{
//Act
var result = await handler.Handle(new GetProductByIdQuery { Id = "1" }, CancellationToken.None);
//Assert
Assert.IsNotNull(result);
}
}