Adding
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="MemberPreference\**" />
|
||||
<EmbeddedResource Remove="MemberPreference\**" />
|
||||
<None Remove="MemberPreference\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LCU.Api.Internal.FTPLib" Version="2.11.2" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||
<PackageReference Include="nunit" Version="4.1.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Include="FluentAssertions" Version="5.10.3" />
|
||||
<PackageReference Include="Moq" Version="4.13.1" />
|
||||
<PackageReference Include="Respawn" Version="3.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LCU.API.Internal.MemberPreferencesApi\LCU.API.Internal.MemberPreferencesApi.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using LCU.API.Internal.MemberPreferencesApiLib.Repositories;
|
||||
using LCU.API.Internal.MemberPreferencesApi.Services.XdiServices;
|
||||
using LCU.API.Internal.MemberPreferencesApi.Configuration;
|
||||
using LCU.Library.Internal.MemberPreferencesApiModels.Entities;
|
||||
using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
|
||||
using LCU.Library.Internal.LcuMassTransitModels;
|
||||
using LCU.API.Internal.MemberPreferencesApi.MicroApiServices;
|
||||
|
||||
namespace LCU.API.Internal.MemberPreferencesApi.IntegrationTests
|
||||
{
|
||||
public class XdiTransferTest
|
||||
{
|
||||
private IXdiBatchService _xdiBatchItemService;
|
||||
private Mock<IXdiBatchItemsRepository> _mockBatchItemsRepository;
|
||||
private Mock<IUnitOfWork> _mockUnitOfWork;
|
||||
private XdiSftpApiConfiguration _xdiSftpConfiguration;
|
||||
private FtpApiConfiguration _ftpConfiguration;
|
||||
private Mock<IUnifiedOptInRepository> _mockUnifiedOptinRepository;
|
||||
private Mock<IMemberPreferenceRepository> _mockMemberPreferenceRepository;
|
||||
private Mock<IFtpApiService> _mockFtpApiService;
|
||||
private ConnectionConfiguration _connectionConfiguration;
|
||||
private ReceiveEndpointConfiguration _completionReceiveEndpoint;
|
||||
private ReceiveEndpointConfigurations _endpointConfiguration;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_mockFtpApiService = new Mock<IFtpApiService>();
|
||||
_connectionConfiguration = new ConnectionConfiguration();
|
||||
_mockBatchItemsRepository = new Mock<IXdiBatchItemsRepository>();
|
||||
_mockMemberPreferenceRepository = new Mock<IMemberPreferenceRepository>();
|
||||
_endpointConfiguration = new ReceiveEndpointConfigurations();
|
||||
_completionReceiveEndpoint = _endpointConfiguration.XdiBatchConfirmEndpoint;
|
||||
_mockUnitOfWork = new Mock<IUnitOfWork>();
|
||||
_ftpConfiguration = new FtpApiConfiguration()
|
||||
{
|
||||
Url = "https://qa-ftpapi.lcu-internal.com/api/"
|
||||
};
|
||||
_xdiSftpConfiguration = new XdiSftpApiConfiguration()
|
||||
|
||||
{
|
||||
HostName = "sftp.xdi.com",
|
||||
UserName = "LANDMARKCU",
|
||||
PortNumber = 22,
|
||||
Password = "FILLMEIN",
|
||||
Fingerprint = "ssh-dss 2048 12:78:33:0a:cf:71:21:e2:8b:0e:ef:6a:8a:c6:8e:4f"
|
||||
};
|
||||
|
||||
_mockUnifiedOptinRepository = new Mock<IUnifiedOptInRepository>();
|
||||
_xdiBatchItemService = new XdiBatchService(_mockBatchItemsRepository.Object, _mockUnitOfWork.Object,
|
||||
_xdiSftpConfiguration, _mockUnifiedOptinRepository.Object, _mockMemberPreferenceRepository.Object,
|
||||
_connectionConfiguration, _endpointConfiguration, _mockFtpApiService.Object);
|
||||
}
|
||||
|
||||
|
||||
[Ignore("This will actually create the items and FTP them to XDI Test Folder. Be Careful. Fill in password.")]
|
||||
public void Test_Send_Test_Files()
|
||||
{
|
||||
IReadOnlyCollection<XdiBatchItem> items = new List<XdiBatchItem>()
|
||||
{
|
||||
new XdiBatchItem()
|
||||
{
|
||||
Created = DateTime.Now,
|
||||
BatchState = BatchState.New,
|
||||
LastUpdated = DateTime.Now,
|
||||
UserId = "99"
|
||||
},
|
||||
new XdiBatchItem()
|
||||
{
|
||||
Created = DateTime.Now,
|
||||
BatchState = BatchState.New,
|
||||
LastUpdated = DateTime.Now,
|
||||
UserId = "100"
|
||||
},
|
||||
new XdiBatchItem()
|
||||
{
|
||||
Created = DateTime.Now,
|
||||
BatchState = BatchState.New,
|
||||
LastUpdated = DateTime.Now,
|
||||
UserId = "101"
|
||||
},
|
||||
new XdiBatchItem()
|
||||
{
|
||||
Created = DateTime.Now,
|
||||
BatchState = BatchState.New,
|
||||
LastUpdated = DateTime.Now,
|
||||
UserId = "102"
|
||||
},
|
||||
new XdiBatchItem()
|
||||
{
|
||||
Created = DateTime.Now,
|
||||
BatchState = BatchState.New,
|
||||
LastUpdated = DateTime.Now,
|
||||
UserId = "103"
|
||||
}
|
||||
};
|
||||
|
||||
var settings = new List<MemberOptInSettings>()
|
||||
{
|
||||
new MemberOptInSettings()
|
||||
{
|
||||
Id = 1000,
|
||||
UniversalOptIn = DeliveryPreference.Paper,
|
||||
ENotifications = DeliveryPreference.Electronic,
|
||||
EStatements = DeliveryPreference.Electronic,
|
||||
UnifiedOptInEmail = "[email protected]",
|
||||
ENotificationsEmail = "[email protected]",
|
||||
EStatementsEmail = "[email protected]",
|
||||
LastUpdated = DateTime.Now,
|
||||
LegalDate = DateTime.Now,
|
||||
LegalVersion = "1.2.3",
|
||||
UserId = "99",
|
||||
CreatedByType = UserType.Associate,
|
||||
LastUpdatedByType = UserType.System,
|
||||
CreatedBy = "test",
|
||||
Created = DateTime.Now,
|
||||
LastUpdatedBy = "test"
|
||||
},
|
||||
new MemberOptInSettings()
|
||||
{
|
||||
Id = 1001,
|
||||
UniversalOptIn = DeliveryPreference.Paper,
|
||||
ENotifications = null,
|
||||
EStatements = DeliveryPreference.Electronic,
|
||||
UnifiedOptInEmail = "[email protected]",
|
||||
ENotificationsEmail = null,
|
||||
EStatementsEmail = "[email protected]",
|
||||
UserId = "100"
|
||||
},
|
||||
new MemberOptInSettings()
|
||||
{
|
||||
Id = 1002,
|
||||
UniversalOptIn = DeliveryPreference.Electronic,
|
||||
ENotifications = DeliveryPreference.Paper,
|
||||
EStatements = DeliveryPreference.Paper,
|
||||
UnifiedOptInEmail = "[email protected]",
|
||||
ENotificationsEmail = "[email protected]",
|
||||
EStatementsEmail = "[email protected]",
|
||||
UserId = "101"
|
||||
},
|
||||
new MemberOptInSettings()
|
||||
{
|
||||
Id = 1003,
|
||||
UniversalOptIn = DeliveryPreference.Electronic,
|
||||
ENotifications = null,
|
||||
EStatements = DeliveryPreference.Paper,
|
||||
UnifiedOptInEmail = "[email protected]",
|
||||
ENotificationsEmail = null,
|
||||
EStatementsEmail = null,
|
||||
UserId = "102"
|
||||
},
|
||||
new MemberOptInSettings()
|
||||
{
|
||||
Id = 1004,
|
||||
UniversalOptIn = DeliveryPreference.Electronic,
|
||||
ENotifications = DeliveryPreference.Electronic,
|
||||
EStatements = DeliveryPreference.Electronic,
|
||||
UnifiedOptInEmail = "[email protected]",
|
||||
ENotificationsEmail = "[email protected]",
|
||||
EStatementsEmail = "[email protected]",
|
||||
UserId = "103"
|
||||
}
|
||||
};
|
||||
|
||||
_mockBatchItemsRepository.Setup(x => x.GetXdiBatchItems()).ReturnsAsync(items);
|
||||
|
||||
foreach (var setting in settings)
|
||||
{
|
||||
_mockUnifiedOptinRepository.Setup(x => x.GetMemberOptInSettings(setting.UserId))
|
||||
.ReturnsAsync(setting);
|
||||
}
|
||||
|
||||
_mockBatchItemsRepository.Setup(x => x.SaveAsync(It.IsAny<XdiBatchItem>())).Verifiable();
|
||||
_mockBatchItemsRepository.Setup(x => x.Delete(It.IsAny<XdiBatchItem>())).Verifiable();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user