forked from ddrilling/AsbCloudServer
Дописаны автотесты
This commit is contained in:
parent
ef8d559739
commit
6e34f5f4c6
@ -26,9 +26,7 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
= Substitute.For<IWellOperationRepository>();
|
= Substitute.For<IWellOperationRepository>();
|
||||||
private IWellService wellService
|
private IWellService wellService
|
||||||
= Substitute.For<IWellService>();
|
= Substitute.For<IWellService>();
|
||||||
|
private List<int> idsWells;
|
||||||
|
|
||||||
|
|
||||||
private readonly static IEnumerable<WellOperationCategoryDto> operationCategories = new List<WellOperationCategoryDto>()
|
private readonly static IEnumerable<WellOperationCategoryDto> operationCategories = new List<WellOperationCategoryDto>()
|
||||||
{
|
{
|
||||||
new(){Id = 5096, Name = "Шаблонирование перед спуском"},
|
new(){Id = 5096, Name = "Шаблонирование перед спуском"},
|
||||||
@ -47,6 +45,12 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
new() {Id = 31, Caption = "Техническая колонна", Order = 2}
|
new() {Id = 31, Caption = "Техническая колонна", Order = 2}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private readonly static IEnumerable<WellDto> wells = new List<WellDto>()
|
||||||
|
{
|
||||||
|
new() {Id = 55, Caption = "Скважина с ключом 55"},
|
||||||
|
new() {Id = 64, Caption = "Скважина с ключом 64"},
|
||||||
|
};
|
||||||
|
|
||||||
private readonly static IEnumerable<WellOperationDto> wellOperations1 = new List<WellOperationDto>()
|
private readonly static IEnumerable<WellOperationDto> wellOperations1 = new List<WellOperationDto>()
|
||||||
{
|
{
|
||||||
new()
|
new()
|
||||||
@ -162,6 +166,11 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
wellOperationCategoryRepository.Get(Arg.Any<bool>())
|
wellOperationCategoryRepository.Get(Arg.Any<bool>())
|
||||||
.Returns(operationCategories);
|
.Returns(operationCategories);
|
||||||
|
|
||||||
|
idsWells = new List<int>() { 55, 64 };
|
||||||
|
|
||||||
|
wellService.GetAsync(Arg.Any<WellRequest>(), Arg.Any<CancellationToken>())
|
||||||
|
.Returns(wells);
|
||||||
|
|
||||||
service = new WellCompositeOperationService(
|
service = new WellCompositeOperationService(
|
||||||
wellSectionTypeRepository,
|
wellSectionTypeRepository,
|
||||||
wellOperationCategoryRepository,
|
wellOperationCategoryRepository,
|
||||||
@ -182,10 +191,8 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
||||||
.Returns(wellOperations1);
|
.Returns(wellOperations1);
|
||||||
|
|
||||||
var idsWell = new List<int>() { 55, 64 };
|
|
||||||
|
|
||||||
// act
|
// act
|
||||||
var result = await service.GetAsync(idsWell, CancellationToken.None);
|
var result = await service.GetAsync(idsWells, CancellationToken.None);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
var compositeWellOperations = result.WellOperationsComposite;
|
var compositeWellOperations = result.WellOperationsComposite;
|
||||||
@ -211,10 +218,8 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
||||||
.Returns(wellOperations2);
|
.Returns(wellOperations2);
|
||||||
|
|
||||||
var idsWell = new List<int>() { 55, 64 };
|
|
||||||
|
|
||||||
// act
|
// act
|
||||||
var result = await service.GetAsync(idsWell, CancellationToken.None);
|
var result = await service.GetAsync(idsWells, CancellationToken.None);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
var compositeWellOperations = result.WellOperationsComposite;
|
var compositeWellOperations = result.WellOperationsComposite;
|
||||||
@ -237,10 +242,8 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
||||||
.Returns(wellOperations3);
|
.Returns(wellOperations3);
|
||||||
|
|
||||||
var idsWell = new List<int>() { 55, 64 };
|
|
||||||
|
|
||||||
// act
|
// act
|
||||||
var result = await service.GetAsync(idsWell, CancellationToken.None);
|
var result = await service.GetAsync(idsWells, CancellationToken.None);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
var compositeWellOperations = result.WellOperationsComposite;
|
var compositeWellOperations = result.WellOperationsComposite;
|
||||||
@ -265,10 +268,8 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
||||||
.Returns(wellOperations4);
|
.Returns(wellOperations4);
|
||||||
|
|
||||||
var idsWell = new List<int>() { 55, 64 };
|
|
||||||
|
|
||||||
// act
|
// act
|
||||||
var result = await service.GetAsync(idsWell, CancellationToken.None);
|
var result = await service.GetAsync(idsWells, CancellationToken.None);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
var compositeWellOperations = result.WellOperationsComposite;
|
var compositeWellOperations = result.WellOperationsComposite;
|
||||||
@ -297,10 +298,8 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
||||||
.Returns(wellOperations);
|
.Returns(wellOperations);
|
||||||
|
|
||||||
var idsWell = new List<int>() { 55, 64 };
|
|
||||||
|
|
||||||
// act
|
// act
|
||||||
var result = await service.GetAsync(idsWell, CancellationToken.None);
|
var result = await service.GetAsync(idsWells, CancellationToken.None);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
var wellOperationsCount = result.WellCompositeSourceOperations
|
var wellOperationsCount = result.WellCompositeSourceOperations
|
||||||
|
Loading…
Reference in New Issue
Block a user