使用分布式事件总线异步通信

This commit is contained in:
administrator committed 2024-09-24 22:53:54 +08:00
1 parent 385b09d482
commit c16d6ece15
26 files changed
+1130 -91

No files matched your search

@@ -36,7 +36,12 @@ namespace HelloShop.ProductService.UnitTests
// Arrange
Mock<IProductService> mock = new();
mock.Setup(m => m.GetAllAsync(It.IsAny<CancellationToken>())).ReturnsAsync([new Product { Id = 1, Name = "Product 1", Price = 10 }, new Product { Id = 2, Name = "Product 2", Price = 20 }]);
var mockProducts = new List<Product> {
new() { Id = 1, Name = "Product 1", Description = "Product 1", ImageUrl = "1.jpg", Price = 10 },
new() { Id = 2, Name = "Product 2",Description="Product 2", ImageUrl="2.jpg", Price = 20 }
};
mock.Setup(m => m.GetAllAsync(It.IsAny<CancellationToken>())).ReturnsAsync(mockProducts);
// Act
IMapper mapper = new Mapper(new MapperConfiguration(cfg => cfg.CreateMap<Product, ProductListItem>()));