diff --git a/AsbCloudApp/Services/IAnalyticsService.cs b/AsbCloudApp/Services/ITelemetryAnalyticsService.cs similarity index 96% rename from AsbCloudApp/Services/IAnalyticsService.cs rename to AsbCloudApp/Services/ITelemetryAnalyticsService.cs index 1a5d4f40..04a9ec2a 100644 --- a/AsbCloudApp/Services/IAnalyticsService.cs +++ b/AsbCloudApp/Services/ITelemetryAnalyticsService.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace AsbCloudApp.Services { - public interface IAnalyticsService + public interface ITelemetryAnalyticsService { Task> GetOperationsByWellAsync(int idWell, IEnumerable categoryids = default, DateTime begin = default, diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index 64a4c7e9..09488b1f 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -34,7 +34,7 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/AsbCloudInfrastructure/Services/DataService.cs b/AsbCloudInfrastructure/Services/DataService.cs index 06f94187..7d657144 100644 --- a/AsbCloudInfrastructure/Services/DataService.cs +++ b/AsbCloudInfrastructure/Services/DataService.cs @@ -16,12 +16,12 @@ namespace AsbCloudInfrastructure.Services { private readonly IAsbCloudDbContext db; private readonly ITelemetryService telemetryService; - private readonly IAnalyticsService analyticsService; + private readonly ITelemetryAnalyticsService analyticsService; private readonly CacheTable cacheTelemetry; private readonly CacheTable cacheWells; public DataService(IAsbCloudDbContext db, ITelemetryService telemetryService, - IAnalyticsService analyticsService, CacheDb cacheDb) + ITelemetryAnalyticsService analyticsService, CacheDb cacheDb) { this.db = db; this.telemetryService = telemetryService; diff --git a/AsbCloudInfrastructure/Services/AnalyticsService.cs b/AsbCloudInfrastructure/Services/TelemetryAnalyticsService.cs similarity index 99% rename from AsbCloudInfrastructure/Services/AnalyticsService.cs rename to AsbCloudInfrastructure/Services/TelemetryAnalyticsService.cs index e1a393f0..2004ed8a 100644 --- a/AsbCloudInfrastructure/Services/AnalyticsService.cs +++ b/AsbCloudInfrastructure/Services/TelemetryAnalyticsService.cs @@ -12,7 +12,7 @@ using System.Threading.Tasks; namespace AsbCloudInfrastructure.Services { - public class AnalyticsService : IAnalyticsService + public class TelemetryAnalyticsService : ITelemetryAnalyticsService { private readonly IAsbCloudDbContext db; private readonly ITelemetryService telemetryService; @@ -21,7 +21,7 @@ namespace AsbCloudInfrastructure.Services private readonly TelemetryOperationDetectorService operationDetectorService; private readonly IEnumerable operations; - public AnalyticsService(IAsbCloudDbContext db, ITelemetryService telemetryService, + public TelemetryAnalyticsService(IAsbCloudDbContext db, ITelemetryService telemetryService, ISaubDataCache saubDataCache, CacheDb cacheDb) { this.db = db; diff --git a/AsbCloudWebApi.Tests/ControllersTests/AnalyticsControllerTests.cs b/AsbCloudWebApi.Tests/ControllersTests/AnalyticsControllerTests.cs index 2a6d742e..9fb78ddc 100644 --- a/AsbCloudWebApi.Tests/ControllersTests/AnalyticsControllerTests.cs +++ b/AsbCloudWebApi.Tests/ControllersTests/AnalyticsControllerTests.cs @@ -13,15 +13,15 @@ namespace AsbCloudWebApi.Tests.ControllersTests { public class AnalyticsControllerTests { - private readonly Mock analyticsService; + private readonly Mock analyticsService; private readonly Mock wellService; - private readonly AnalyticsController controller; + private readonly TelemetryAnalyticsController controller; private readonly List depthToDayDtos; // fills class fields with data. Each test inside can change this data themselves for their needs public AnalyticsControllerTests() { - analyticsService = new Mock(); + analyticsService = new Mock(); wellService = new Mock(); depthToDayDtos = new List() @@ -37,7 +37,7 @@ namespace AsbCloudWebApi.Tests.ControllersTests wellService.Setup(s => s.IsCompanyInvolvedInWell(It.IsAny(), It.IsAny())) .Returns(true); - controller = new AnalyticsController(analyticsService.Object, + controller = new TelemetryAnalyticsController(analyticsService.Object, wellService.Object); var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] @@ -73,7 +73,7 @@ namespace AsbCloudWebApi.Tests.ControllersTests [Fact] public void It_should_return_403_if_no_idCompany() { - var emptyUserController = new AnalyticsController(analyticsService.Object, + var emptyUserController = new TelemetryAnalyticsController(analyticsService.Object, wellService.Object); var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { }, "mock")); @@ -97,7 +97,7 @@ namespace AsbCloudWebApi.Tests.ControllersTests wellServiceReturnsFalse.Setup(s => s.IsCompanyInvolvedInWell(It.IsAny(), It.IsAny())) .Returns(false); - var newControllerInstance = new AnalyticsController(analyticsService.Object, + var newControllerInstance = new TelemetryAnalyticsController(analyticsService.Object, wellServiceReturnsFalse.Object); var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] @@ -119,12 +119,12 @@ namespace AsbCloudWebApi.Tests.ControllersTests [Fact] public void It_should_return_204_if_dtos_is_empty() { - var emptyAnalyticsService = new Mock(); + var emptyAnalyticsService = new Mock(); emptyAnalyticsService.Setup(s => s.GetWellDepthToDay(It.IsAny())) .Returns(new List()); - var newControllerInstance = new AnalyticsController(emptyAnalyticsService.Object, + var newControllerInstance = new TelemetryAnalyticsController(emptyAnalyticsService.Object, wellService.Object); var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] @@ -146,12 +146,12 @@ namespace AsbCloudWebApi.Tests.ControllersTests [Fact] public void It_should_return_204_if_dtos_is_null() { - var emptyAnalyticsService = new Mock(); + var emptyAnalyticsService = new Mock(); emptyAnalyticsService.Setup(s => s.GetWellDepthToDay(It.IsAny())) .Returns(value: null); - var newControllerInstance = new AnalyticsController(emptyAnalyticsService.Object, + var newControllerInstance = new TelemetryAnalyticsController(emptyAnalyticsService.Object, wellService.Object); var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] diff --git a/AsbCloudWebApi/Controllers/AnalyticsController.cs b/AsbCloudWebApi/Controllers/TelemetryAnalyticsController.cs similarity index 97% rename from AsbCloudWebApi/Controllers/AnalyticsController.cs rename to AsbCloudWebApi/Controllers/TelemetryAnalyticsController.cs index 8d0fa0e0..2f129f8f 100644 --- a/AsbCloudWebApi/Controllers/AnalyticsController.cs +++ b/AsbCloudWebApi/Controllers/TelemetryAnalyticsController.cs @@ -13,12 +13,12 @@ namespace AsbCloudWebApi.Controllers [Route("api/analytics")] [ApiController] [Authorize] - public class AnalyticsController : ControllerBase + public class TelemetryAnalyticsController : ControllerBase { - private readonly IAnalyticsService analyticsService; + private readonly ITelemetryAnalyticsService analyticsService; private readonly IWellService wellService; - public AnalyticsController(IAnalyticsService analyticsService, IWellService wellService) + public TelemetryAnalyticsController(ITelemetryAnalyticsService analyticsService, IWellService wellService) { this.analyticsService = analyticsService; this.wellService = wellService;