From 0b9fd490395ccd772d732a60e839c4936e741d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Wed, 13 Mar 2024 14:49:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Удалён лишний тест. В данном тесте никогда не возникнет BadRequest. Если идентификатор скважины не валиден у нас возникнет Forbidden. 2. Сделал коллекцию прав потокобезопасной, чтобы не возникало состояние RaiseCondition --- .../ProcessMapPlanDrillingControllerTest.cs | 16 +--------------- AsbCloudWebApi/PermissionAttribute.cs | 5 ++--- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapPlanDrillingControllerTest.cs b/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapPlanDrillingControllerTest.cs index c5335ae0..6f21bd0b 100644 --- a/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapPlanDrillingControllerTest.cs +++ b/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapPlanDrillingControllerTest.cs @@ -150,21 +150,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest //assert Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); } - - [Fact] - public async Task InsertRange_returns_BadRequest_for_IdWell() - { - //arrange - var badDto = dto.Adapt(); - badDto.IdWell = int.MaxValue; - - //act - var response = await client.InsertRange(dto.IdWell, new[] { badDto }); - - //assert - Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); - } - + [Fact] public async Task ClearAndInsertRange_returns_success() { diff --git a/AsbCloudWebApi/PermissionAttribute.cs b/AsbCloudWebApi/PermissionAttribute.cs index 1249b531..775617a1 100644 --- a/AsbCloudWebApi/PermissionAttribute.cs +++ b/AsbCloudWebApi/PermissionAttribute.cs @@ -1,13 +1,12 @@ using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; +using System.Collections.Concurrent; namespace AsbCloudWebApi { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public class PermissionAttribute : Attribute { - public static SortedSet Registered { get; } = new SortedSet(); + public static ConcurrentBag Registered { get; } = new(); public string Name { get; set; } = null!;