Add mocked broker client
This commit is contained in:
42
Hcs.Broker.Mock/Api/MockBillsApi.cs
Normal file
42
Hcs.Broker.Mock/Api/MockBillsApi.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using Hcs.Broker.Api;
|
||||
using Hcs.Broker.Api.Payload.Bills;
|
||||
using Hcs.Service.Async.Bills;
|
||||
|
||||
namespace Hcs.Broker.Mock.Api
|
||||
{
|
||||
/// <inheritdoc cref="IBillsApi"/>
|
||||
public class MockBillsApi : IBillsApi
|
||||
{
|
||||
/// <inheritdoc cref="IBillsApi"/>
|
||||
public async Task<IEnumerable<exportPaymentDocumentResultType>> ExportPaymentDocumentDataByAccountNumberAsync(short year, int month, string fiasHouseGuid, string accountNumber, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBillsApi"/>
|
||||
public async Task<IEnumerable<exportPaymentDocumentResultType>> ExportPaymentDocumentDataByPaymentDocumentIDAsync(string paymentDocumentID, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBillsApi"/>
|
||||
public async Task<IEnumerable<exportPaymentDocumentResultType>> ExportPaymentDocumentDataByPaymentDocumentNumberAsync(short year, int month, string fiasHouseGuid, string paymentDocumentNumber, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBillsApi"/>
|
||||
public async Task<bool> ImportPaymentDocumentDataAsync(ImportPaymentDocumentDataPayload payload, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Hcs.Broker.Mock/Api/MockDeviceMeteringApi.cs
Normal file
26
Hcs.Broker.Mock/Api/MockDeviceMeteringApi.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using Hcs.Broker.Api;
|
||||
using Hcs.Broker.Api.Payload.DeviceMetering;
|
||||
using Hcs.Service.Async.DeviceMetering;
|
||||
|
||||
namespace Hcs.Broker.Mock.Api
|
||||
{
|
||||
/// <inheritdoc cref="IDeviceMeteringApi"/>
|
||||
public class MockDeviceMeteringApi : IDeviceMeteringApi
|
||||
{
|
||||
/// <inheritdoc cref="IDeviceMeteringApi"/>
|
||||
public async Task<IEnumerable<exportMeteringDeviceHistoryResultType>> ExportMeteringDeviceHistoryAsync(ExportMeteringDeviceHistoryPayload payload, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IDeviceMeteringApi"/>
|
||||
public async Task<bool> ImportMeteringDeviceValuesAsync(importMeteringDeviceValuesRequestMeteringDevicesValues values, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
114
Hcs.Broker.Mock/Api/MockHouseManagementApi.cs
Normal file
114
Hcs.Broker.Mock/Api/MockHouseManagementApi.cs
Normal file
@ -0,0 +1,114 @@
|
||||
using Hcs.Broker.Api;
|
||||
using Hcs.Broker.Api.Payload.HouseManagement;
|
||||
using Hcs.Service.Async.HouseManagement;
|
||||
|
||||
namespace Hcs.Broker.Mock.Api
|
||||
{
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public class MockHouseManagementApi : IHouseManagementApi
|
||||
{
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public async Task<IEnumerable<exportAccountResultType>> ExportAccountAsync(string fiasHouseGuid, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public async Task<IEnumerable<exportHouseResultType>> ExportHouseAsync(string fiasHouseGuid, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public async Task<IEnumerable<exportSupplyResourceContractResultType>> ExportSupplyResourceContractDataAsync(CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public async Task<exportSupplyResourceContractResultType> ExportSupplyResourceContractDataAsync(Guid contractRootGuid, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public async Task<exportSupplyResourceContractResultType> ExportSupplyResourceContractDataAsync(string contractNumber, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public async Task<IEnumerable<exportSupplyResourceContractObjectAddressResultType>> ExportSupplyResourceContractObjectAddressDataAsync(Guid contractRootGuid, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public async Task<bool> ImportAccountDataAsync(ImportAccountDataPayload payload, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public async Task<importContractResultType> ImportContractDataAsync(ImportContractDataPayload payload, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public async Task<bool> ImportHouseUODataAsync(ImportLivingHouseUODataPayload payload, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public async Task<bool> ImportMeteringDeviceDataAsync(MeteringDeviceFullInformationType meteringDevice, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public async Task<bool> ImportNotificationDataAsync(ImportNotificationDataPayload payload, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public async Task<getStateResultImportResultCommonResultImportSupplyResourceContract> ImportSupplyResourceContractDataAsync(ImportSupplyResourceContractDataPayload payload, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IHouseManagementApi"/>
|
||||
public async Task<getStateResultImportResultCommonResultImportSupplyResourceContractProject> ImportSupplyResourceContractProjectAsync(ImportSupplyResourceContractProjectPayload payload, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Hcs.Broker.Mock/Api/MockNsiApi.cs
Normal file
17
Hcs.Broker.Mock/Api/MockNsiApi.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using Hcs.Broker.Api;
|
||||
using Hcs.Service.Async.Nsi;
|
||||
|
||||
namespace Hcs.Broker.Mock.Api
|
||||
{
|
||||
/// <inheritdoc cref="INsiApi"/>
|
||||
public class MockNsiApi : INsiApi
|
||||
{
|
||||
/// <inheritdoc cref="INsiApi"/>
|
||||
public async Task<IEnumerable<NsiItemType>> ExportDataProviderNsiItemAsync(exportDataProviderNsiItemRequestRegistryNumber registryNumber, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Hcs.Broker.Mock/Api/MockNsiCommonApi.cs
Normal file
25
Hcs.Broker.Mock/Api/MockNsiCommonApi.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Hcs.Broker.Api;
|
||||
using Hcs.Service.Async.NsiCommon;
|
||||
|
||||
namespace Hcs.Broker.Mock.Api
|
||||
{
|
||||
/// <inheritdoc cref="INsiCommonApi"/>
|
||||
public class MockNsiCommonApi : INsiCommonApi
|
||||
{
|
||||
/// <inheritdoc cref="INsiCommonApi"/>
|
||||
public async Task<NsiItemType> ExportNsiItemAsync(int registryNumber, ListGroup listGroup, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="INsiCommonApi"/>
|
||||
public async Task<NsiListType> ExportNsiListAsync(ListGroup listGroup, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Hcs.Broker.Mock/Api/MockOrgRegistryCommonApi.cs
Normal file
25
Hcs.Broker.Mock/Api/MockOrgRegistryCommonApi.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Hcs.Broker.Api;
|
||||
using Hcs.Service.Async.OrgRegistryCommon;
|
||||
|
||||
namespace Hcs.Broker.Mock.Api
|
||||
{
|
||||
/// <inheritdoc cref="IOrgRegistryCommonApi"/>
|
||||
public class MockOrgRegistryCommonApi : IOrgRegistryCommonApi
|
||||
{
|
||||
/// <inheritdoc cref="IOrgRegistryCommonApi"/>
|
||||
public async Task<IEnumerable<exportDataProviderResultType>> ExportDataProviderAsync(bool isActual, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IOrgRegistryCommonApi"/>
|
||||
public async Task<IEnumerable<exportOrgRegistryResultType>> ExportOrgRegistryAsync(string ogrn, string kpp, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Hcs.Broker.Mock/Api/MockPaymentsApi.cs
Normal file
25
Hcs.Broker.Mock/Api/MockPaymentsApi.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Hcs.Broker.Api;
|
||||
using Hcs.Broker.Api.Payload.Payments;
|
||||
|
||||
namespace Hcs.Broker.Mock.Api
|
||||
{
|
||||
/// <inheritdoc cref="IPaymentsApi"/>
|
||||
public class MockPaymentsApi : IPaymentsApi
|
||||
{
|
||||
/// <inheritdoc cref="IPaymentsApi"/>
|
||||
public async Task<bool> ImportNotificationsOfOrderExecutionAsync(ImportNotificationsOfOrderExecutionPayload payload, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IPaymentsApi"/>
|
||||
public async Task<bool> ImportSupplierNotificationsOfOrderExecutionAsync(ImportSupplierNotificationsOfOrderExecutionPayload payload, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(3000, token);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Hcs.Broker.Mock/Hcs.Broker.Mock.csproj
Normal file
13
Hcs.Broker.Mock/Hcs.Broker.Mock.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Hcs.Broker\Hcs.Broker.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
48
Hcs.Broker.Mock/MockClient.cs
Normal file
48
Hcs.Broker.Mock/MockClient.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using Hcs.Broker.Api;
|
||||
using Hcs.Broker.Logger;
|
||||
using Hcs.Broker.MessageCapturer;
|
||||
using Hcs.Broker.Mock.Api;
|
||||
|
||||
namespace Hcs.Broker.Mock
|
||||
{
|
||||
/// <inheritdoc cref="IClient"/>
|
||||
public class MockClient : IClient
|
||||
{
|
||||
/// <inheritdoc cref="IClient"/>
|
||||
public string OrgPPAGUID { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IClient"/>
|
||||
public string ExecutorGUID { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IClient"/>
|
||||
public bool UseTunnel { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IClient"/>
|
||||
public bool IsPPAK { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IClient"/>
|
||||
public OrganizationRole Role { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IClient"/>
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IClient"/>
|
||||
public IMessageCapturer MessageCapturer { get; set; }
|
||||
|
||||
public IBillsApi Bills => new MockBillsApi();
|
||||
|
||||
public IDeviceMeteringApi DeviceMetering => new MockDeviceMeteringApi();
|
||||
|
||||
public IHouseManagementApi HouseManagement => new MockHouseManagementApi();
|
||||
|
||||
public INsiApi Nsi => new MockNsiApi();
|
||||
|
||||
public INsiCommonApi NsiCommon => new MockNsiCommonApi();
|
||||
|
||||
public IOrgRegistryCommonApi OrgRegistryCommon => new MockOrgRegistryCommonApi();
|
||||
|
||||
public IPaymentsApi Payments => new MockPaymentsApi();
|
||||
|
||||
public void SetSigningCertificate(string serialNumber, string? pin = null) { }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user