forked from ddrilling/AsbCloudServer
Renamed Analytics Service and Controller to TelemetryAnalytics
This commit is contained in:
parent
fa63d18fa3
commit
1956eafb32
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudApp.Services
|
||||
{
|
||||
public interface IAnalyticsService
|
||||
public interface ITelemetryAnalyticsService
|
||||
{
|
||||
Task<PaginationContainer<TelemetryOperationDto>> GetOperationsByWellAsync(int idWell,
|
||||
IEnumerable<int> categoryids = default, DateTime begin = default,
|
@ -34,7 +34,7 @@ namespace AsbCloudInfrastructure
|
||||
services.AddTransient<IEventService, EventService>();
|
||||
services.AddTransient<ITelemetryUserService, TelemetryUserService>();
|
||||
services.AddTransient<IReportService, ReportService>();
|
||||
services.AddTransient<IAnalyticsService, AnalyticsService>();
|
||||
services.AddTransient<ITelemetryAnalyticsService, TelemetryAnalyticsService>();
|
||||
services.AddTransient<IFileService, FileService>();
|
||||
services.AddTransient<IWellSectionService, WellSectionService>();
|
||||
|
||||
|
@ -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<Telemetry> cacheTelemetry;
|
||||
private readonly CacheTable<Well> cacheWells;
|
||||
|
||||
public DataService(IAsbCloudDbContext db, ITelemetryService telemetryService,
|
||||
IAnalyticsService analyticsService, CacheDb cacheDb)
|
||||
ITelemetryAnalyticsService analyticsService, CacheDb cacheDb)
|
||||
{
|
||||
this.db = db;
|
||||
this.telemetryService = telemetryService;
|
||||
|
@ -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<Operation> operations;
|
||||
|
||||
public AnalyticsService(IAsbCloudDbContext db, ITelemetryService telemetryService,
|
||||
public TelemetryAnalyticsService(IAsbCloudDbContext db, ITelemetryService telemetryService,
|
||||
ISaubDataCache saubDataCache, CacheDb cacheDb)
|
||||
{
|
||||
this.db = db;
|
@ -13,15 +13,15 @@ namespace AsbCloudWebApi.Tests.ControllersTests
|
||||
{
|
||||
public class AnalyticsControllerTests
|
||||
{
|
||||
private readonly Mock<IAnalyticsService> analyticsService;
|
||||
private readonly Mock<ITelemetryAnalyticsService> analyticsService;
|
||||
private readonly Mock<IWellService> wellService;
|
||||
private readonly AnalyticsController controller;
|
||||
private readonly TelemetryAnalyticsController controller;
|
||||
private readonly List<WellDepthToDayDto> depthToDayDtos;
|
||||
|
||||
// fills class fields with data. Each test inside can change this data themselves for their needs
|
||||
public AnalyticsControllerTests()
|
||||
{
|
||||
analyticsService = new Mock<IAnalyticsService>();
|
||||
analyticsService = new Mock<ITelemetryAnalyticsService>();
|
||||
wellService = new Mock<IWellService>();
|
||||
|
||||
depthToDayDtos = new List<WellDepthToDayDto>()
|
||||
@ -37,7 +37,7 @@ namespace AsbCloudWebApi.Tests.ControllersTests
|
||||
wellService.Setup(s => s.IsCompanyInvolvedInWell(It.IsAny<int>(), It.IsAny<int>()))
|
||||
.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<int>(), It.IsAny<int>()))
|
||||
.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<IAnalyticsService>();
|
||||
var emptyAnalyticsService = new Mock<ITelemetryAnalyticsService>();
|
||||
|
||||
emptyAnalyticsService.Setup(s => s.GetWellDepthToDay(It.IsAny<int>()))
|
||||
.Returns(new List<WellDepthToDayDto>());
|
||||
|
||||
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<IAnalyticsService>();
|
||||
var emptyAnalyticsService = new Mock<ITelemetryAnalyticsService>();
|
||||
|
||||
emptyAnalyticsService.Setup(s => s.GetWellDepthToDay(It.IsAny<int>()))
|
||||
.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[]
|
||||
|
@ -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;
|
Loading…
Reference in New Issue
Block a user