diff --git a/README.md b/README.md index 722c33f..674bdef 100644 --- a/README.md +++ b/README.md @@ -282,7 +282,7 @@ docker-compose up Детали конфигурации docker-compose вы можете найти [здесь](https://github.com/bezlla/RtuItLab/blob/master/src/docker-compose.yml). ### UnitTests -В проекте есть Smoke - тесты, для запуска которых необходимо запустить менеджера RabbitMQ. +В проекте есть Smoke - тесты, для запуска которых необходимо запустить менеджера RabbitMQ и SQLServer из docker вручную. Дефолтные настройки для них прописаны в файлах ```appsettings.Tests.json```, которые подключаются во время прогона тестов. Они покрывают доступность функционала. diff --git a/src/RtuItLab.Infrastructure/MassTransit/Purchases/Responses/GetTransactionsResponse.cs b/src/RtuItLab.Infrastructure/MassTransit/Purchases/Responses/GetTransactionsResponse.cs index 7c64d22..6d6d5d8 100644 --- a/src/RtuItLab.Infrastructure/MassTransit/Purchases/Responses/GetTransactionsResponse.cs +++ b/src/RtuItLab.Infrastructure/MassTransit/Purchases/Responses/GetTransactionsResponse.cs @@ -5,7 +5,7 @@ namespace RtuItLab.Infrastructure.MassTransit.Purchases.Responses { public class GetTransactionsResponse { - public List Transactions { get; set; } - public int Count { get; set; } + public ICollection Transactions { get; set; } + public int Count => Transactions.Count; } } diff --git a/src/RtuItLab.Infrastructure/MassTransit/Shops/Responses/GetProductsResponse.cs b/src/RtuItLab.Infrastructure/MassTransit/Shops/Responses/GetProductsResponse.cs index c1bf72d..5854706 100644 --- a/src/RtuItLab.Infrastructure/MassTransit/Shops/Responses/GetProductsResponse.cs +++ b/src/RtuItLab.Infrastructure/MassTransit/Shops/Responses/GetProductsResponse.cs @@ -5,7 +5,6 @@ namespace RtuItLab.Infrastructure.MassTransit.Shops.Responses { public class GetProductsResponse { - public bool Success { get; set; } - public List Products { get; set; } + public ICollection Products { get; set; } } } diff --git a/src/RtuItLab.Infrastructure/MassTransit/Shops/Responses/GetShopsResponse.cs b/src/RtuItLab.Infrastructure/MassTransit/Shops/Responses/GetShopsResponse.cs new file mode 100644 index 0000000..5f8bf8a --- /dev/null +++ b/src/RtuItLab.Infrastructure/MassTransit/Shops/Responses/GetShopsResponse.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using RtuItLab.Infrastructure.Models.Shops; + +namespace RtuItLab.Infrastructure.MassTransit.Shops.Responses +{ + public class GetShopsResponse + { + public ICollection Shops { get; set; } + } +} diff --git a/src/Services/Identity/Identity.API/Controllers/AccountController.cs b/src/Services/Identity/Identity.API/Controllers/AccountController.cs index 6e84069..4ac6454 100644 --- a/src/Services/Identity/Identity.API/Controllers/AccountController.cs +++ b/src/Services/Identity/Identity.API/Controllers/AccountController.cs @@ -2,7 +2,6 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using RtuItLab.Infrastructure.Filters; -using RtuItLab.Infrastructure.MassTransit; using RtuItLab.Infrastructure.Models; using RtuItLab.Infrastructure.Models.Identity; using System; diff --git a/src/Services/Identity/Identity.API/Startup.cs b/src/Services/Identity/Identity.API/Startup.cs index adfce68..3782862 100644 --- a/src/Services/Identity/Identity.API/Startup.cs +++ b/src/Services/Identity/Identity.API/Startup.cs @@ -90,7 +90,7 @@ public void ConfigureServices(IServiceCollection services) x.UsingRabbitMq((context, cfg) => { - cfg.Host(new Uri("rabbitmq://host.docker.internal/")); + cfg.Host(new Uri(Configuration["RabbitMq"])); cfg.ReceiveEndpoint("identityQueue", e => { e.PrefetchCount = 20; diff --git a/src/Services/Identity/Identity.API/appsettings.Tests.json b/src/Services/Identity/Identity.API/appsettings.Tests.json new file mode 100644 index 0000000..ab37720 --- /dev/null +++ b/src/Services/Identity/Identity.API/appsettings.Tests.json @@ -0,0 +1,13 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*", + "Secret": "7c9e6679-7425-40de-944b-e07fc1f90ae6", + "DefaultConnection": "Server=127.0.0.1;Database=identity;User=sa;Password=YourPassword123;", + "RabbitMq": "rabbitmq://127.0.0.1/" +} diff --git a/src/Services/Identity/Identity.API/appsettings.json b/src/Services/Identity/Identity.API/appsettings.json index d8784f0..35b22b8 100644 --- a/src/Services/Identity/Identity.API/appsettings.json +++ b/src/Services/Identity/Identity.API/appsettings.json @@ -8,5 +8,6 @@ }, "AllowedHosts": "*", "Secret": "7c9e6679-7425-40de-944b-e07fc1f90ae6", - "DefaultConnection": "Server=db;Database=identity;User=sa;Password=YourPassword123;" + "DefaultConnection": "Server=db;Database=identity;User=sa;Password=YourPassword123;", + "RabbitMq": "rabbitmq://host.docker.internal/" } diff --git a/src/Services/Identity/Identity.Domain/Services/UserService.cs b/src/Services/Identity/Identity.Domain/Services/UserService.cs index 957e311..b73bc2b 100644 --- a/src/Services/Identity/Identity.Domain/Services/UserService.cs +++ b/src/Services/Identity/Identity.Domain/Services/UserService.cs @@ -1,6 +1,5 @@ using Identity.DAL.ContextModels; using Microsoft.AspNetCore.Identity; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; using RtuItLab.Infrastructure.Models.Identity; @@ -11,7 +10,6 @@ using System.Text; using System.Threading.Tasks; using RtuItLab.Infrastructure.Exceptions; -using RtuItLab.Infrastructure.MassTransit; namespace Identity.Domain.Services { diff --git a/src/Services/Identity/tests/Identity.FunctionalTests/Base/IdentityScenariosBase.cs b/src/Services/Identity/tests/Identity.FunctionalTests/Base/IdentityScenariosBase.cs index eca97aa..c41bd63 100644 --- a/src/Services/Identity/tests/Identity.FunctionalTests/Base/IdentityScenariosBase.cs +++ b/src/Services/Identity/tests/Identity.FunctionalTests/Base/IdentityScenariosBase.cs @@ -17,7 +17,7 @@ public TestServer CreateServer() .UseContentRoot(Path.GetDirectoryName(path)) .ConfigureAppConfiguration(cb => { - cb.AddJsonFile("appsettings.json", optional: false) + cb.AddJsonFile("appsettings.Tests.json", optional: false) .AddEnvironmentVariables(); }) .UseUrls("http://*:7001") diff --git a/src/Services/Purchases/Purchases.API/Consumers/GetTransactions.cs b/src/Services/Purchases/Purchases.API/Consumers/GetTransactions.cs index a6c76fd..214223a 100644 --- a/src/Services/Purchases/Purchases.API/Consumers/GetTransactions.cs +++ b/src/Services/Purchases/Purchases.API/Consumers/GetTransactions.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using MassTransit; using Purchases.Domain.Services; +using RtuItLab.Infrastructure.MassTransit.Purchases.Responses; using RtuItLab.Infrastructure.Models.Identity; namespace Purchases.API.Consumers @@ -13,8 +14,8 @@ public GetTransactions( IPurchasesService purchasesService) : base(purchasesServ } public async Task Consume(ConsumeContext context) { - var order = await PurchasesService.GetTransactions(context.Message); - await context.RespondAsync(order); + var transactions = await PurchasesService.GetTransactions(context.Message); + await context.RespondAsync(new GetTransactionsResponse() { Transactions = transactions }); } } } diff --git a/src/Services/Purchases/Purchases.API/Controllers/PurchasesController.cs b/src/Services/Purchases/Purchases.API/Controllers/PurchasesController.cs index 113352f..9e97c08 100644 --- a/src/Services/Purchases/Purchases.API/Controllers/PurchasesController.cs +++ b/src/Services/Purchases/Purchases.API/Controllers/PurchasesController.cs @@ -4,6 +4,7 @@ using RtuItLab.Infrastructure.Filters; using RtuItLab.Infrastructure.MassTransit; using RtuItLab.Infrastructure.MassTransit.Purchases.Requests; +using RtuItLab.Infrastructure.MassTransit.Purchases.Responses; using RtuItLab.Infrastructure.Models; using RtuItLab.Infrastructure.Models.Identity; using RtuItLab.Infrastructure.Models.Purchases; @@ -29,8 +30,8 @@ public PurchasesController(IBusControl busControl) public async Task GetAllHistory() { var user = HttpContext.Items["User"] as User; - var response = await GetResponseRabbitTask>(user); - return Ok(ApiResult>.Success200(response)); + var response = await GetResponseRabbitTask(user); + return Ok(ApiResult.Success200(response)); } [HttpGet("{id}")] public async Task GetHistory(int id) @@ -58,7 +59,7 @@ await GetResponseRabbitTask(new return Ok(ApiResult.Success200(transaction.Id)); } [HttpPut("update")] - public async Task UpdateTransaction( [FromBody] UpdateTransaction updateTransaction) + public async Task UpdateTransaction([FromBody] UpdateTransaction updateTransaction) { if (!ModelState.IsValid) return BadRequest("Invalid request"); var user = HttpContext.Items["User"] as User; diff --git a/src/Services/Purchases/Purchases.API/Startup.cs b/src/Services/Purchases/Purchases.API/Startup.cs index fd0aa06..6704a21 100644 --- a/src/Services/Purchases/Purchases.API/Startup.cs +++ b/src/Services/Purchases/Purchases.API/Startup.cs @@ -62,8 +62,7 @@ public void ConfigureServices(IServiceCollection services) }, Scheme = "oauth2", Name = "Bearer", - In = ParameterLocation.Header, - + In = ParameterLocation.Header }, new List() } @@ -83,7 +82,7 @@ public void ConfigureServices(IServiceCollection services) x.UsingRabbitMq((context, cfg) => { - cfg.Host(new Uri("rabbitmq://host.docker.internal/")); + cfg.Host(new Uri(Configuration["RabbitMq"])); cfg.ReceiveEndpoint("purchasesQueue", e => { e.PrefetchCount = 20; diff --git a/src/Services/Purchases/Purchases.API/appsettings.Tests.json b/src/Services/Purchases/Purchases.API/appsettings.Tests.json new file mode 100644 index 0000000..ab37720 --- /dev/null +++ b/src/Services/Purchases/Purchases.API/appsettings.Tests.json @@ -0,0 +1,13 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*", + "Secret": "7c9e6679-7425-40de-944b-e07fc1f90ae6", + "DefaultConnection": "Server=127.0.0.1;Database=identity;User=sa;Password=YourPassword123;", + "RabbitMq": "rabbitmq://127.0.0.1/" +} diff --git a/src/Services/Purchases/Purchases.API/appsettings.json b/src/Services/Purchases/Purchases.API/appsettings.json index aa5a2ff..3ac9b03 100644 --- a/src/Services/Purchases/Purchases.API/appsettings.json +++ b/src/Services/Purchases/Purchases.API/appsettings.json @@ -7,5 +7,7 @@ } }, "AllowedHosts": "*", - "DefaultConnection": "Server=db;Database=purchases;User=sa;Password=YourPassword123;" + "Secret": "7c9e6679-7425-40de-944b-e07fc1f90ae6", + "DefaultConnection": "Server=db;Database=purchases;User=sa;Password=YourPassword123;", + "RabbitMq": "rabbitmq://host.docker.internal/" } diff --git a/src/Services/Purchases/tests/Purchases.FunctionalTests/Base/PurchasesScenariosBase.cs b/src/Services/Purchases/tests/Purchases.FunctionalTests/Base/PurchasesScenariosBase.cs index 7acff8b..63cbe3b 100644 --- a/src/Services/Purchases/tests/Purchases.FunctionalTests/Base/PurchasesScenariosBase.cs +++ b/src/Services/Purchases/tests/Purchases.FunctionalTests/Base/PurchasesScenariosBase.cs @@ -17,7 +17,7 @@ public TestServer CreateServer() .UseContentRoot(Path.GetDirectoryName(path)) .ConfigureAppConfiguration(cb => { - cb.AddJsonFile("appsettings.json", optional: false) + cb.AddJsonFile("appsettings.Tests.json", optional: false) .AddEnvironmentVariables(); }) .UseUrls("http://*:7002") diff --git a/src/Services/Shops/Shops.API/Consumers/BuyProducts.cs b/src/Services/Shops/Shops.API/Consumers/BuyProducts.cs index 7a8c47c..5e379c0 100644 --- a/src/Services/Shops/Shops.API/Consumers/BuyProducts.cs +++ b/src/Services/Shops/Shops.API/Consumers/BuyProducts.cs @@ -3,6 +3,7 @@ using MassTransit; using RtuItLab.Infrastructure.MassTransit.Purchases.Requests; using RtuItLab.Infrastructure.MassTransit.Shops.Requests; +using RtuItLab.Infrastructure.MassTransit.Shops.Responses; using Shops.Domain.Services; namespace Shops.API.Consumers @@ -20,11 +21,11 @@ public BuyProducts(IShopsService shopsService, public async Task Consume(ConsumeContext context) { - var order = await ShopsService.BuyProducts(context.Message.ShopId, context.Message.Products); - await context.RespondAsync(order); + var products = await ShopsService.BuyProducts(context.Message.ShopId, context.Message.Products); + await context.RespondAsync(new GetProductsResponse() { Products = products }); var transaction = - await ShopsService.CreateTransaction(context.Message.ShopId, order); + await ShopsService.CreateTransaction(context.Message.ShopId, products); await ShopsService.AddReceipt(transaction.Receipt); var endpoint = await _busControl.GetSendEndpoint(_rabbitMqUrl); diff --git a/src/Services/Shops/Shops.API/Consumers/GetAllShops.cs b/src/Services/Shops/Shops.API/Consumers/GetAllShops.cs index 7ac04ca..c43e4ea 100644 --- a/src/Services/Shops/Shops.API/Consumers/GetAllShops.cs +++ b/src/Services/Shops/Shops.API/Consumers/GetAllShops.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using MassTransit; using RtuItLab.Infrastructure.MassTransit.Shops.Requests; +using RtuItLab.Infrastructure.MassTransit.Shops.Responses; using Shops.Domain.Services; namespace Shops.API.Consumers @@ -12,8 +13,8 @@ public GetAllShops(IShopsService shopsService) : base(shopsService) } public async Task Consume(ConsumeContext context) { - var order = ShopsService.GetAllShops(); - await context.RespondAsync(order); + var shops = ShopsService.GetAllShops(); + await context.RespondAsync(new GetShopsResponse() { Shops = shops }); } } } diff --git a/src/Services/Shops/Shops.API/Consumers/GetProductsByCategory.cs b/src/Services/Shops/Shops.API/Consumers/GetProductsByCategory.cs index 4f02917..9c7d619 100644 --- a/src/Services/Shops/Shops.API/Consumers/GetProductsByCategory.cs +++ b/src/Services/Shops/Shops.API/Consumers/GetProductsByCategory.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using MassTransit; using RtuItLab.Infrastructure.MassTransit.Shops.Requests; +using RtuItLab.Infrastructure.MassTransit.Shops.Responses; using Shops.Domain.Services; namespace Shops.API.Consumers @@ -13,8 +14,8 @@ public GetProductsByCategory( IShopsService shopsService) : base(shopsService) public async Task Consume(ConsumeContext context) { - var order = await ShopsService.GetProductsByCategory(context.Message.ShopId, context.Message.Category); - await context.RespondAsync(order); + var products = await ShopsService.GetProductsByCategory(context.Message.ShopId, context.Message.Category); + await context.RespondAsync(new GetProductsResponse() { Products = products }); } } } diff --git a/src/Services/Shops/Shops.API/Consumers/GetProductsByShop.cs b/src/Services/Shops/Shops.API/Consumers/GetProductsByShop.cs index 942b1c4..56d5514 100644 --- a/src/Services/Shops/Shops.API/Consumers/GetProductsByShop.cs +++ b/src/Services/Shops/Shops.API/Consumers/GetProductsByShop.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using MassTransit; using RtuItLab.Infrastructure.MassTransit.Shops.Requests; +using RtuItLab.Infrastructure.MassTransit.Shops.Responses; using Shops.Domain.Services; namespace Shops.API.Consumers @@ -14,7 +15,7 @@ public GetProductsByShop(IShopsService shopsService) : base(shopsService) public async Task Consume(ConsumeContext context) { var products = await ShopsService.GetProductsByShop(context.Message.ShopId); - await context.RespondAsync(products); + await context.RespondAsync(new GetProductsResponse() { Products = products }); } } } diff --git a/src/Services/Shops/Shops.API/Controllers/ShopsController.cs b/src/Services/Shops/Shops.API/Controllers/ShopsController.cs index e48c9c1..a21c743 100644 --- a/src/Services/Shops/Shops.API/Controllers/ShopsController.cs +++ b/src/Services/Shops/Shops.API/Controllers/ShopsController.cs @@ -3,6 +3,7 @@ using RtuItLab.Infrastructure.Filters; using RtuItLab.Infrastructure.MassTransit; using RtuItLab.Infrastructure.MassTransit.Shops.Requests; +using RtuItLab.Infrastructure.MassTransit.Shops.Responses; using RtuItLab.Infrastructure.Models; using RtuItLab.Infrastructure.Models.Identity; using RtuItLab.Infrastructure.Models.Shops; @@ -26,30 +27,30 @@ public ShopsController(IBusControl busControl) [HttpGet] public async Task GetAllShops() { - var response = await GetResponseRabbitTask>(new GetAllShopsRequest()); - return Ok(ApiResult>.Success200(response)); + var response = await GetResponseRabbitTask (new GetAllShopsRequest()); + return Ok(ApiResult.Success200(response)); } [HttpGet("{shopId}")] public async Task GetProducts(int shopId) { - var response = await GetResponseRabbitTask>(new GetProductsRequest + var response = await GetResponseRabbitTask(new GetProductsRequest { ShopId = shopId, }); - return Ok(ApiResult>.Success200(response)); + return Ok(ApiResult.Success200(response)); } [HttpPost("{shopId}/find_by_category")] public async Task GetProductsByCategory(int shopId, [FromBody] Category category) { if (!ModelState.IsValid) return BadRequest(); - var response = await GetResponseRabbitTask>(new GetProductsByCategoryRequest + var response = await GetResponseRabbitTask(new GetProductsByCategoryRequest { ShopId = shopId, Category = category.CategoryName }); - return Ok(ApiResult>.Success200(response)); + return Ok(ApiResult.Success200(response)); } [Authorize] @@ -58,13 +59,13 @@ public async Task BuyProducts(int shopId, [FromBody] ICollection< { if (!ModelState.IsValid) return BadRequest(); var user = HttpContext.Items["User"] as User; - var productsResponse = await GetResponseRabbitTask>(new BuyProductsRequest() + var productsResponse = await GetResponseRabbitTask(new BuyProductsRequest() { User = user, ShopId = shopId, Products = products, }); - return Ok(ApiResult>.Success200(productsResponse)); + return Ok(ApiResult.Success200(productsResponse)); } private async Task GetResponseRabbitTask(TIn request) where TIn : class diff --git a/src/Services/Shops/Shops.API/Startup.cs b/src/Services/Shops/Shops.API/Startup.cs index c0dd96f..4cdfa99 100644 --- a/src/Services/Shops/Shops.API/Startup.cs +++ b/src/Services/Shops/Shops.API/Startup.cs @@ -84,7 +84,7 @@ public void ConfigureServices(IServiceCollection services) x.AddConsumer(); x.UsingRabbitMq((context, cfg) => { - cfg.Host(new Uri("rabbitmq://host.docker.internal/")); + cfg.Host(new Uri(Configuration["RabbitMq"])); cfg.ReceiveEndpoint("shopsQueue", e => { e.PrefetchCount = 20; diff --git a/src/Services/Shops/Shops.API/appsettings.Tests.json b/src/Services/Shops/Shops.API/appsettings.Tests.json new file mode 100644 index 0000000..f5348fe --- /dev/null +++ b/src/Services/Shops/Shops.API/appsettings.Tests.json @@ -0,0 +1,13 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*", + "Secret": "7c9e6679-7425-40de-944b-e07fc1f90ae6", + "DefaultConnection": "Server=127.0.0.1;Database=shops;User=sa;Password=YourPassword123;", + "RabbitMq": "rabbitmq://127.0.0.1/" +} diff --git a/src/Services/Shops/Shops.API/appsettings.json b/src/Services/Shops/Shops.API/appsettings.json index 6175a1f..1f515b7 100644 --- a/src/Services/Shops/Shops.API/appsettings.json +++ b/src/Services/Shops/Shops.API/appsettings.json @@ -7,5 +7,7 @@ } }, "AllowedHosts": "*", - "DefaultConnection": "Server=db;Database=shops;User=sa;Password=YourPassword123;" + "Secret": "7c9e6679-7425-40de-944b-e07fc1f90ae6", + "DefaultConnection": "Server=db;Database=shops;User=sa;Password=YourPassword123;", + "RabbitMq": "rabbitmq://host.docker.internal/" } diff --git a/src/Services/Shops/Shops.Domain/Services/IShopsService.cs b/src/Services/Shops/Shops.Domain/Services/IShopsService.cs index 2ff449f..5ebbe97 100644 --- a/src/Services/Shops/Shops.Domain/Services/IShopsService.cs +++ b/src/Services/Shops/Shops.Domain/Services/IShopsService.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Threading.Tasks; -using RtuItLab.Infrastructure.MassTransit; using RtuItLab.Infrastructure.Models.Purchases; using RtuItLab.Infrastructure.Models.Shops; diff --git a/src/Services/Shops/tests/Shops.FunctionalTests/Base/ShopsScenariosBase.cs b/src/Services/Shops/tests/Shops.FunctionalTests/Base/ShopsScenariosBase.cs index d752e5d..40ef6a3 100644 --- a/src/Services/Shops/tests/Shops.FunctionalTests/Base/ShopsScenariosBase.cs +++ b/src/Services/Shops/tests/Shops.FunctionalTests/Base/ShopsScenariosBase.cs @@ -17,7 +17,7 @@ public TestServer CreateServer() .UseContentRoot(Path.GetDirectoryName(path)) .ConfigureAppConfiguration(cb => { - cb.AddJsonFile("appsettings.json", optional: false) + cb.AddJsonFile("appsettings.Tests.json", optional: false) .AddEnvironmentVariables(); }) .UseUrls("http://*:7003") diff --git a/src/Services/Shops/tests/Shops.UnitTests/Services/ShopsServiceUnitTests.cs b/src/Services/Shops/tests/Shops.UnitTests/Services/ShopsServiceUnitTests.cs index 6b3f24d..3ff1a09 100644 --- a/src/Services/Shops/tests/Shops.UnitTests/Services/ShopsServiceUnitTests.cs +++ b/src/Services/Shops/tests/Shops.UnitTests/Services/ShopsServiceUnitTests.cs @@ -1,9 +1,7 @@ -using System.Collections.Generic; -using System.Linq; +using System.Linq; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using RtuItLab.Infrastructure.Exceptions; -using RtuItLab.Infrastructure.Models.Shops; using Shops.DAL.Data; using Shops.Domain.Services; using Xunit; @@ -41,9 +39,8 @@ public async Task GetProductsByShopId_Expected_Shops_And_Included_All_products() [Fact] public async Task GetProductsByShopId_Expected_Throw_NotFoundException() { - var response = await _shopsService.GetProductsByShop(1251252151); - Assert.NotNull(response); - Assert.IsType(response); + var action = _shopsService.GetProductsByShop(1251252151); + await Assert.ThrowsAsync(() => action); } [Fact] public async Task GetProductsByCategoryInShop_Expected_Success()