forked from ddrilling/AsbCloudServer
Фиксация для слияния
This commit is contained in:
parent
42e2c57c1b
commit
6c89c32ab3
@ -6,4 +6,8 @@
|
|||||||
<Nullable>disable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="System.Linq" Version="4.3.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
5808
AsbCloudDb/Migrations/20220520095808_AddDeillerModel.Designer.cs
generated
Normal file
5808
AsbCloudDb/Migrations/20220520095808_AddDeillerModel.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
87
AsbCloudDb/Migrations/20220520095808_AddDeillerModel.cs
Normal file
87
AsbCloudDb/Migrations/20220520095808_AddDeillerModel.cs
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Migrations
|
||||||
|
{
|
||||||
|
public partial class AddDeillerModel : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "caption",
|
||||||
|
table: "t_well_type",
|
||||||
|
type: "character varying(255)",
|
||||||
|
maxLength: 255,
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "",
|
||||||
|
comment: "Название",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "character varying(255)",
|
||||||
|
oldMaxLength: 255,
|
||||||
|
oldNullable: true,
|
||||||
|
oldComment: "Название");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "caption",
|
||||||
|
table: "t_well_section_type",
|
||||||
|
type: "character varying(255)",
|
||||||
|
maxLength: 255,
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "",
|
||||||
|
comment: "Название",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "character varying(255)",
|
||||||
|
oldMaxLength: 255,
|
||||||
|
oldNullable: true,
|
||||||
|
oldComment: "Название");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "t_driller",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, comment: "Имя"),
|
||||||
|
surname = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, comment: "Фамилия"),
|
||||||
|
patronymic = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, comment: "Отчество")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_t_driller", x => x.id);
|
||||||
|
},
|
||||||
|
comment: "Бурильщик");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "t_driller");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "caption",
|
||||||
|
table: "t_well_type",
|
||||||
|
type: "character varying(255)",
|
||||||
|
maxLength: 255,
|
||||||
|
nullable: true,
|
||||||
|
comment: "Название",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "character varying(255)",
|
||||||
|
oldMaxLength: 255,
|
||||||
|
oldComment: "Название");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "caption",
|
||||||
|
table: "t_well_section_type",
|
||||||
|
type: "character varying(255)",
|
||||||
|
maxLength: 255,
|
||||||
|
nullable: true,
|
||||||
|
comment: "Название",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "character varying(255)",
|
||||||
|
oldMaxLength: 255,
|
||||||
|
oldComment: "Название");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
5808
AsbCloudDb/Migrations/20220522083739_AddSchedule.Designer.cs
generated
Normal file
5808
AsbCloudDb/Migrations/20220522083739_AddSchedule.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
19
AsbCloudDb/Migrations/20220522083739_AddSchedule.cs
Normal file
19
AsbCloudDb/Migrations/20220522083739_AddSchedule.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Migrations
|
||||||
|
{
|
||||||
|
public partial class AddSchedule : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
5808
AsbCloudDb/Migrations/20220522084746_ChangeDateSchedule.Designer.cs
generated
Normal file
5808
AsbCloudDb/Migrations/20220522084746_ChangeDateSchedule.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
19
AsbCloudDb/Migrations/20220522084746_ChangeDateSchedule.cs
Normal file
19
AsbCloudDb/Migrations/20220522084746_ChangeDateSchedule.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Migrations
|
||||||
|
{
|
||||||
|
public partial class ChangeDateSchedule : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
5878
AsbCloudDb/Migrations/20220522103542_AddSchedule1.Designer.cs
generated
Normal file
5878
AsbCloudDb/Migrations/20220522103542_AddSchedule1.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
61
AsbCloudDb/Migrations/20220522103542_AddSchedule1.cs
Normal file
61
AsbCloudDb/Migrations/20220522103542_AddSchedule1.cs
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Migrations
|
||||||
|
{
|
||||||
|
public partial class AddSchedule1 : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "t_schedule",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
id_driller = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор бурильщика"),
|
||||||
|
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор скважины"),
|
||||||
|
shift_start = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Начало смены"),
|
||||||
|
shift_end = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Конец смены"),
|
||||||
|
drill_start = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Начало бурение"),
|
||||||
|
drill_end = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Конец бурения")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_t_schedule", x => x.id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_t_schedule_t_driller_id_driller",
|
||||||
|
column: x => x.id_driller,
|
||||||
|
principalTable: "t_driller",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_t_schedule_t_well_id_well",
|
||||||
|
column: x => x.id_well,
|
||||||
|
principalTable: "t_well",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
},
|
||||||
|
comment: "График работы бурильщика");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_t_schedule_id_driller",
|
||||||
|
table: "t_schedule",
|
||||||
|
column: "id_driller");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_t_schedule_id_well",
|
||||||
|
table: "t_schedule",
|
||||||
|
column: "id_well");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "t_schedule");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
5883
AsbCloudDb/Migrations/20220525121826_AddInvertLink.Designer.cs
generated
Normal file
5883
AsbCloudDb/Migrations/20220525121826_AddInvertLink.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
19
AsbCloudDb/Migrations/20220525121826_AddInvertLink.cs
Normal file
19
AsbCloudDb/Migrations/20220525121826_AddInvertLink.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Migrations
|
||||||
|
{
|
||||||
|
public partial class AddInvertLink : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
5884
AsbCloudDb/Migrations/20220525130143_ChangeModel.Designer.cs
generated
Normal file
5884
AsbCloudDb/Migrations/20220525130143_ChangeModel.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
19
AsbCloudDb/Migrations/20220525130143_ChangeModel.cs
Normal file
19
AsbCloudDb/Migrations/20220525130143_ChangeModel.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Migrations
|
||||||
|
{
|
||||||
|
public partial class ChangeModel : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
5884
AsbCloudDb/Migrations/20220525131550_ChangeModel2.Designer.cs
generated
Normal file
5884
AsbCloudDb/Migrations/20220525131550_ChangeModel2.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
39
AsbCloudDb/Migrations/20220525131550_ChangeModel2.cs
Normal file
39
AsbCloudDb/Migrations/20220525131550_ChangeModel2.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Migrations
|
||||||
|
{
|
||||||
|
public partial class ChangeModel2 : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_t_schedule_t_driller_id_driller",
|
||||||
|
table: "t_schedule");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "t_schedule_t_driller_id_driller",
|
||||||
|
table: "t_schedule",
|
||||||
|
column: "id_driller",
|
||||||
|
principalTable: "t_driller",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "t_schedule_t_driller_id_driller",
|
||||||
|
table: "t_schedule");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_t_schedule_t_driller_id_driller",
|
||||||
|
table: "t_schedule",
|
||||||
|
column: "id_driller",
|
||||||
|
principalTable: "t_driller",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -868,6 +868,57 @@ namespace AsbCloudDb.Migrations
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("AsbCloudDb.Model.OperationValue", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("id")
|
||||||
|
.HasComment("Идентификатор");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<double>("DepthEnd")
|
||||||
|
.HasColumnType("double precision")
|
||||||
|
.HasColumnName("depth_end")
|
||||||
|
.HasComment("Конечная глубина");
|
||||||
|
|
||||||
|
b.Property<double>("DepthStart")
|
||||||
|
.HasColumnType("double precision")
|
||||||
|
.HasColumnName("depth_start")
|
||||||
|
.HasComment("Старотовая глубина");
|
||||||
|
|
||||||
|
b.Property<int>("IdOperationCategory")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("id_operation_category")
|
||||||
|
.HasComment("Ид категории операции");
|
||||||
|
|
||||||
|
b.Property<int>("IdWell")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("id_well")
|
||||||
|
.HasComment("Ид скважины");
|
||||||
|
|
||||||
|
b.Property<double>("StandardValue")
|
||||||
|
.HasColumnType("double precision")
|
||||||
|
.HasColumnName("standard_value")
|
||||||
|
.HasComment("Нормативный показатель");
|
||||||
|
|
||||||
|
b.Property<double>("TargetValue")
|
||||||
|
.HasColumnType("double precision")
|
||||||
|
.HasColumnName("target_value")
|
||||||
|
.HasComment("Целевой показатель");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("IdOperationCategory");
|
||||||
|
|
||||||
|
b.HasIndex("IdWell");
|
||||||
|
|
||||||
|
b.ToTable("t_operationvalue");
|
||||||
|
|
||||||
|
b.HasComment("Целевые/нормативные показатели операции");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.Permission", b =>
|
modelBuilder.Entity("AsbCloudDb.Model.Permission", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -5468,6 +5519,25 @@ namespace AsbCloudDb.Migrations
|
|||||||
b.Navigation("Well");
|
b.Navigation("Well");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("AsbCloudDb.Model.OperationValue", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("IdOperationCategory")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("AsbCloudDb.Model.Well", "Well")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("IdWell")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("OperationCategory");
|
||||||
|
|
||||||
|
b.Navigation("Well");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>
|
modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("AsbCloudDb.Model.Company", "Company")
|
b.HasOne("AsbCloudDb.Model.Company", "Company")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
@ -0,0 +1,97 @@
|
|||||||
|
using AsbCloudApp.Data;
|
||||||
|
using AsbCloudApp.Data.SAUB;
|
||||||
|
using AsbCloudApp.Services;
|
||||||
|
using AsbCloudDb.Model;
|
||||||
|
using AsbCloudInfrastructure.Services;
|
||||||
|
using AsbCloudInfrastructure.Services.Cache;
|
||||||
|
using AsbCloudInfrastructure.Services.DetectOperations;
|
||||||
|
using Moq;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace AsbCloudWebApi.Tests.ServicesTests
|
||||||
|
{
|
||||||
|
public class DetectedOperationServiceTest
|
||||||
|
{
|
||||||
|
private readonly AsbCloudDbContext context;
|
||||||
|
private readonly CacheDb cacheDb;
|
||||||
|
private readonly DetectedOperationService service;
|
||||||
|
#region Задача данных
|
||||||
|
private Deposit deposit = new Deposit { Id = 1, Caption = "Депозит 1" };
|
||||||
|
private Cluster cluster = new Cluster { Id = 1, Caption = "Кластер 1", IdDeposit = 1, Timezone = new SimpleTimezone() };
|
||||||
|
private Well well = new Well
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Caption = "Test well 1",
|
||||||
|
IdTelemetry=1,
|
||||||
|
IdCluster = 1,
|
||||||
|
Timezone = new SimpleTimezone { Hours = 5 }
|
||||||
|
};
|
||||||
|
private Driller driller = new Driller
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Name = "Тестовый",
|
||||||
|
Patronymic = "Тест",
|
||||||
|
Surname = "Тестович"
|
||||||
|
};
|
||||||
|
private DetectedOperation do1 = new DetectedOperation
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
IdCategory = 1,
|
||||||
|
IdTelemetry = 1,
|
||||||
|
DateStart = DateTimeOffset.Parse("2022-05-16T10:00:00.286Z"),
|
||||||
|
DateEnd = DateTimeOffset.Parse("2022-05-16T18:00:00.286Z"),
|
||||||
|
DepthStart = 100,
|
||||||
|
DepthEnd = 1000
|
||||||
|
};
|
||||||
|
private Telemetry telemetry = new Telemetry
|
||||||
|
{
|
||||||
|
Id=1,
|
||||||
|
RemoteUid = Guid.NewGuid().ToString()
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public DetectedOperationServiceTest()
|
||||||
|
{
|
||||||
|
context = TestHelpter.MakeTestContext();
|
||||||
|
context.SaveChanges();
|
||||||
|
|
||||||
|
context.Telemetries.Add(telemetry);
|
||||||
|
context.Deposits.Add(deposit);
|
||||||
|
context.Clusters.Add(cluster);
|
||||||
|
context.Wells.Add(well);
|
||||||
|
context.Drillers.Add(driller);
|
||||||
|
context.DetectedOperations.Add(do1);
|
||||||
|
|
||||||
|
context.SaveChanges();
|
||||||
|
|
||||||
|
var timezone = new SimpleTimezoneDto { Hours = 5 };
|
||||||
|
var wellServiceMock = new Mock<IWellService>();
|
||||||
|
wellServiceMock.Setup(s => s.GetTimezone(It.IsAny<int>())).Returns(timezone);
|
||||||
|
var operationValueService = new OperationValueService(context);
|
||||||
|
var scheduleService = new ScheduleService(context, wellServiceMock.Object);
|
||||||
|
|
||||||
|
service = new DetectedOperationService(context, wellServiceMock.Object, operationValueService, scheduleService);
|
||||||
|
AsbCloudInfrastructure.DependencyInjection.MapsterSetup();
|
||||||
|
}
|
||||||
|
|
||||||
|
~DetectedOperationServiceTest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Count_grouping_by_driller()
|
||||||
|
{
|
||||||
|
var count = 10;
|
||||||
|
var list = await service.GetAsync(1, null, CancellationToken.None);
|
||||||
|
Assert.Equal(3, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -34,8 +34,8 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
|||||||
{
|
{
|
||||||
IdWell = dto?.IdWell ?? 1,
|
IdWell = dto?.IdWell ?? 1,
|
||||||
IdDriller = dto?.IdDriller ?? 1,
|
IdDriller = dto?.IdDriller ?? 1,
|
||||||
ShiftStart = dto?.ShiftStart ?? new TimeOnly(10, 00),
|
//ShiftStart = dto?.ShiftStart ?? new TimeOnly(10, 00),
|
||||||
ShiftEnd = dto?.ShiftEnd ?? new TimeOnly(18, 00),
|
//ShiftEnd = dto?.ShiftEnd ?? new TimeOnly(18, 00),
|
||||||
DrillStart = dto?.DrillStart ?? DateTime.Parse("2022-05-16T10:00:00.286Z"),
|
DrillStart = dto?.DrillStart ?? DateTime.Parse("2022-05-16T10:00:00.286Z"),
|
||||||
DrillEnd = dto?.DrillEnd ?? DateTime.Parse("2022-05-16T18:00:00.286Z")
|
DrillEnd = dto?.DrillEnd ?? DateTime.Parse("2022-05-16T18:00:00.286Z")
|
||||||
};
|
};
|
||||||
@ -114,8 +114,8 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
|||||||
public async Task GetDriller_by_workTime_shift1()
|
public async Task GetDriller_by_workTime_shift1()
|
||||||
{
|
{
|
||||||
var dto = MakeScheduleDto();
|
var dto = MakeScheduleDto();
|
||||||
dto.ShiftStart = new TimeOnly(8, 00);
|
//dto.ShiftStart = new TimeOnly(8, 00);
|
||||||
dto.ShiftEnd = new TimeOnly(20, 00);
|
//dto.ShiftEnd = new TimeOnly(20, 00);
|
||||||
var id = await scheduleService.InsertAsync(dto, CancellationToken.None);
|
var id = await scheduleService.InsertAsync(dto, CancellationToken.None);
|
||||||
var drillerWorkTime = new DateTime(
|
var drillerWorkTime = new DateTime(
|
||||||
dto.DrillStart.Year,
|
dto.DrillStart.Year,
|
||||||
@ -130,8 +130,8 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
|||||||
public async Task GetDriller_by_workTime_shift2()
|
public async Task GetDriller_by_workTime_shift2()
|
||||||
{
|
{
|
||||||
var dto = MakeScheduleDto();
|
var dto = MakeScheduleDto();
|
||||||
dto.ShiftStart = new TimeOnly(20, 00);
|
//dto.ShiftStart = new TimeOnly(20, 00);
|
||||||
dto.ShiftEnd = new TimeOnly(8, 00);
|
//dto.ShiftEnd = new TimeOnly(8, 00);
|
||||||
var id = await scheduleService.InsertAsync(dto, CancellationToken.None);
|
var id = await scheduleService.InsertAsync(dto, CancellationToken.None);
|
||||||
var drillerWorkTime = new DateTime(
|
var drillerWorkTime = new DateTime(
|
||||||
dto.DrillStart.Year,
|
dto.DrillStart.Year,
|
||||||
|
8
ConsoleApp1/Properties/launchSettings.json
Normal file
8
ConsoleApp1/Properties/launchSettings.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"WSL": {
|
||||||
|
"commandName": "WSL2",
|
||||||
|
"distributionName": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user