first commit
This commit is contained in:
+57
@@ -0,0 +1,57 @@
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using Landmark.OLA.Models.Addresses;
|
||||
|
||||
namespace Landmark.OLA.Integration.Tests
|
||||
{
|
||||
public class AddressValidationControllerTest : OlaIntegrationTest
|
||||
{
|
||||
public Address testResult;
|
||||
|
||||
public AddressValidationControllerTest() : base()
|
||||
{
|
||||
testResult = new Address()
|
||||
{
|
||||
Address1 = "111 South First Street",
|
||||
City = "Milwaukee",
|
||||
State = Models.Addresses.Enums.StateOption.WI,
|
||||
PostalCode = "53207",
|
||||
Country = Models.Addresses.Enums.CountryOption.UnitedStates
|
||||
};
|
||||
mockUspsVendorClient.Setup(repo => repo.CompareAddress(It.IsAny<Address>()))
|
||||
.Returns(Task.FromResult(testResult));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CanValidateAddress()
|
||||
{
|
||||
// Arrange
|
||||
var requestAddress = new Address
|
||||
{
|
||||
Address1 = "111 South First Street",
|
||||
City = "Milwaukee",
|
||||
State = Models.Addresses.Enums.StateOption.WI,
|
||||
PostalCode = "53207",
|
||||
Country = Models.Addresses.Enums.CountryOption.UnitedStates
|
||||
};
|
||||
|
||||
// Act
|
||||
var request = new StringContent(JsonConvert.SerializeObject(requestAddress), Encoding.UTF8,
|
||||
"application/json");
|
||||
var httpResponse = await _client.PostAsync("/api/AddressValidation/", request);
|
||||
|
||||
// Must be successful.
|
||||
httpResponse.EnsureSuccessStatusCode();
|
||||
|
||||
// Deserialize and examine results.
|
||||
var stringResponse = await httpResponse.Content.ReadAsStringAsync();
|
||||
var resultAddress = JsonConvert.DeserializeObject<Address>(stringResponse);
|
||||
Assert.NotNull(resultAddress.Address1);
|
||||
Assert.Equal(testResult.Address1, resultAddress.Address1);
|
||||
}
|
||||
}
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
using System.Collections.Generic;
|
||||
using Xunit;
|
||||
using Landmark.OLA.Application.Controllers;
|
||||
using Landmark.OLA.Application.Services;
|
||||
using Landmark.OLA.Models.Core;
|
||||
|
||||
namespace Landmark.OLA.Integration.Tests
|
||||
{
|
||||
public class CoreAccessServiceTest
|
||||
{
|
||||
private readonly CoreAccessService coreAccessService;
|
||||
private readonly List<OnlineIdentityFormData> forms;
|
||||
private readonly List<CoreMemberOwner> owners;
|
||||
|
||||
public CoreAccessServiceTest()
|
||||
{
|
||||
coreAccessService = new CoreAccessService();
|
||||
forms =
|
||||
[
|
||||
new OnlineIdentityFormData()
|
||||
{
|
||||
DateOfBirth = "2009-01-01",
|
||||
SocialSecurityNumber = "9999"
|
||||
},
|
||||
new OnlineIdentityFormData()
|
||||
{
|
||||
DateOfBirth = "01/01/2009",
|
||||
SocialSecurityNumber = "9999"
|
||||
},
|
||||
new OnlineIdentityFormData()
|
||||
{
|
||||
DateOfBirth = "01/01/09",
|
||||
SocialSecurityNumber = "7777"
|
||||
}
|
||||
];
|
||||
owners =
|
||||
[
|
||||
new CoreMemberOwner()
|
||||
{
|
||||
Address = "address",
|
||||
BirthDate = "2009-01-01",
|
||||
DriverLicense = "F620-3888-0442-88",
|
||||
IndividualId = 99,
|
||||
Name = "John Tester",
|
||||
TaxId = "999-99-9999",
|
||||
Type = "Primary"
|
||||
},
|
||||
new CoreMemberOwner()
|
||||
{
|
||||
Address = "address",
|
||||
BirthDate = "2006-01-01",
|
||||
DriverLicense = "F620-3999-0442-99",
|
||||
IndividualId = 100,
|
||||
Name = "Jane Tester",
|
||||
TaxId = "999-99-8888",
|
||||
Type = "Secondary"
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FindMatchingOwner_Bad_Args()
|
||||
{
|
||||
var result = coreAccessService.FindMatchingOwner(null, null);
|
||||
Assert.Null(result);
|
||||
|
||||
var document = new OnlineIdentityFormData()
|
||||
{
|
||||
DateOfBirth = "asdfasd",
|
||||
SocialSecurityNumber = "asdf"
|
||||
};
|
||||
result = coreAccessService.FindMatchingOwner(document, null);
|
||||
Assert.Null(result);
|
||||
|
||||
var ownersEmpty = new List<CoreMemberOwner>() { };
|
||||
result = coreAccessService.FindMatchingOwner(document, ownersEmpty);
|
||||
Assert.Null(result);
|
||||
|
||||
result = coreAccessService.FindMatchingOwner(null, owners);
|
||||
Assert.Null(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FindMatchingOwnerBasic()
|
||||
{
|
||||
var result = coreAccessService.FindMatchingOwner(forms[0], owners);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(owners[0].IndividualId, result.IndividualId);
|
||||
|
||||
result = coreAccessService.FindMatchingOwner(forms[1], owners);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(owners[0].IndividualId, result.IndividualId);
|
||||
|
||||
result = coreAccessService.FindMatchingOwner(forms[2], owners);
|
||||
|
||||
Assert.Null(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DoesOwnerMatchBasic()
|
||||
{
|
||||
Assert.True(coreAccessService.DoesOwnerMatch(owners[0], forms[0]));
|
||||
Assert.True(coreAccessService.DoesOwnerMatch(owners[0], forms[1]));
|
||||
Assert.False(coreAccessService.DoesOwnerMatch(owners[0], forms[2]));
|
||||
Assert.False(coreAccessService.DoesOwnerMatch(owners[1], forms[0]));
|
||||
Assert.False(coreAccessService.DoesOwnerMatch(owners[1], forms[1]));
|
||||
Assert.False(coreAccessService.DoesOwnerMatch(owners[1], forms[2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Moq;
|
||||
using Landmark.OLA.Application;
|
||||
using Landmark.OLA.Application.DataAccess;
|
||||
using Landmark.OLA.Models.Loan;
|
||||
|
||||
namespace Landmark.OLA.Integration.Tests
|
||||
{
|
||||
public class CustomWebApplicationFactory<TStartup> : WebApplicationFactory<Startup>
|
||||
{
|
||||
protected override void ConfigureWebHost(IWebHostBuilder builder)
|
||||
{
|
||||
var contentRoot = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "Landmark.OLA.Application"));
|
||||
|
||||
builder.UseEnvironment("Development");
|
||||
builder.UseContentRoot(contentRoot);
|
||||
builder.ConfigureAppConfiguration((context, config) =>
|
||||
{
|
||||
config.Sources.Clear();
|
||||
config.SetBasePath(contentRoot);
|
||||
config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: false);
|
||||
config.AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||
config.AddEnvironmentVariables();
|
||||
});
|
||||
|
||||
builder.ConfigureServices(services =>
|
||||
{
|
||||
var mockRepo = new Mock<IBranchDataAccess>();
|
||||
mockRepo.Setup(repo => repo.GetBranchConfig()).Returns(new BranchConfig());
|
||||
services.AddScoped<IBranchDataAccess>(_ => mockRepo.Object);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
using System.Threading.Tasks;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using Xunit;
|
||||
using CRIF.ACTion.Services.Crif;
|
||||
using Landmark.OLA.Models.Decisioning;
|
||||
using Landmark.OLA.Models.Decisioning.Enums;
|
||||
|
||||
namespace Landmark.OLA.Integration.Tests
|
||||
{
|
||||
public class DecisionControllerTest : OlaIntegrationTest
|
||||
{
|
||||
public DecisionControllerTest() : base()
|
||||
{
|
||||
var decisionResult = new DecisioningDetails()
|
||||
{
|
||||
DecisioningState = DecisioningState.Ready,
|
||||
DecisioningResult = DecisioningResult.AcceptanceStatus_Provisional
|
||||
};
|
||||
|
||||
mockVendorClient.Setup(repo => repo.GetDecisionStatus("555")).Throws(new Error13Exception("Test Failure"));
|
||||
mockVendorClient.Setup(repo => repo.GetDecisionStatus("444")).ReturnsAsync(decisionResult);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetDecisionSpecialError13()
|
||||
{
|
||||
// The endpoint or route of the controller action.
|
||||
var httpResponse = await _client.GetAsync("/api/LoanApplication/555/DecisioningDetails");
|
||||
|
||||
// Must be successful.
|
||||
httpResponse.EnsureSuccessStatusCode();
|
||||
|
||||
// Deserialize and examine results.
|
||||
var stringResponse = await httpResponse.Content.ReadAsStringAsync();
|
||||
var status = JsonConvert.DeserializeObject<DecisioningDetails>(stringResponse);
|
||||
Assert.Equal(DecisioningState.Unknown, status.DecisioningState);
|
||||
Assert.Equal(DecisioningResult.ProcessStatus_Incomplete, status.DecisioningResult);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetDecisionSuccess()
|
||||
{
|
||||
// The endpoint or route of the controller action.
|
||||
var httpResponse = await _client.GetAsync("/api/LoanApplication/444/DecisioningDetails");
|
||||
|
||||
// Must be successful.
|
||||
httpResponse.EnsureSuccessStatusCode();
|
||||
|
||||
// Deserialize and examine results.
|
||||
var stringResponse = await httpResponse.Content.ReadAsStringAsync();
|
||||
var status = JsonConvert.DeserializeObject<DecisioningDetails>(stringResponse);
|
||||
Assert.Equal(DecisioningState.Ready, status.DecisioningState);
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
|
||||
namespace Landmark.OLA.Integration.Tests
|
||||
{
|
||||
public class IndividualControllerTest : OlaIntegrationTest
|
||||
{
|
||||
|
||||
|
||||
public IndividualControllerTest() : base()
|
||||
{
|
||||
|
||||
}
|
||||
/*
|
||||
[Fact]
|
||||
public async Task CanGetIndividual()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
// Act
|
||||
var httpResponse = await _client.GetAsync("/api/Individual/555555");
|
||||
|
||||
// Must be successful.
|
||||
httpResponse.EnsureSuccessStatusCode();
|
||||
|
||||
// Deserialize and examine results.
|
||||
var stringResponse = await httpResponse.Content.ReadAsStringAsync();
|
||||
var result = JsonConvert.DeserializeObject<CoreIndividual>(stringResponse);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(555555, result.IndividualId);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.21" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
|
||||
<PackageReference Include="Moq" Version="4.10.1" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Landmark.OLA.Application\Landmark.OLA.Application.csproj" />
|
||||
<ProjectReference Include="..\Landmark.OLA.Models\Landmark.OLA.Models.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using Xunit;
|
||||
using CRIF.ACTion.Services.Landmark.DistributionChannel;
|
||||
using Landmark.OLA.Models.Loan;
|
||||
using Landmark.OLA.Models.Loan.Enums;
|
||||
|
||||
namespace Landmark.OLA.Integration.Tests
|
||||
{
|
||||
public class LoanApplicationControllerTest : OlaIntegrationTest
|
||||
{
|
||||
public LoanApplicationControllerTest() : base()
|
||||
{
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SubmitExisting()
|
||||
{
|
||||
// Arrange
|
||||
// mock: loanApplicationStorage.GetContainerById(cosmosId);
|
||||
// mock: _tokenService.GetAuthenticatedDataFromCookie(HttpContext);
|
||||
// mock: loanApplicationStorage.UpdateLoanEnvelop(loanContainer.Id, LoanStatus.Submitted, new LoanError(LoanErrorCode.No_Error, "No_Error"), application.Id);
|
||||
// mock: loanApplicationStorage.DeleteApplication(cosmosId);
|
||||
var mockFoundContainer = new LoanContainer
|
||||
{
|
||||
LoanApplication = new MockApplication().LoanApplication,
|
||||
Status = LoanStatus.In_Progress,
|
||||
Id = "cosmos-123"
|
||||
};
|
||||
var mockLoanFile = new LoanApplicationFile(mockFoundContainer.Id, Guid.NewGuid(), "document.pdf", "Section", "Section-1", "Mock Document");
|
||||
mockFoundContainer.LoanApplication.Files.Add(mockLoanFile);
|
||||
var mockResult = new MockApplication().LoanApplication;
|
||||
mockResult.Id = "123456789";
|
||||
mockVendorClient
|
||||
.Setup(repo => repo.CreateApplicationAndGetId(It.IsAny<LoanApplication>(), It.IsAny<IDistributionChannelLookupService>()))
|
||||
.ReturnsAsync(mockResult.Id);
|
||||
mockVendorClient
|
||||
.Setup(repo => repo.AddFile(It.IsAny<string>(), It.IsAny<LoanApplicationFile>(), It.IsAny<string>()))
|
||||
.ReturnsAsync(true);
|
||||
mockLoanApplicationDataAccess.Setup(repo => repo.GetContainerById(It.IsAny<string>()))
|
||||
.Returns(mockFoundContainer);
|
||||
mockLoanApplicationDataAccess.Setup(repo => repo.UpdateLoanId(It.IsAny<string>(), It.IsAny<string>()));
|
||||
mockLoanApplicationDataAccess.Setup(repo => repo.UpdateError(It.IsAny<string>(), It.IsAny<LoanError>()));
|
||||
mockLoanApplicationDataAccess.Setup(repo => repo.UpdateStatus(It.IsAny<string>(), It.IsAny<LoanStatus>()));
|
||||
mockLoanApplicationDataAccess.Setup(repo => repo.UpdateContainer(It.IsAny<LoanContainer>()));
|
||||
mockLoanApplicationDataAccess.Setup(repo => repo.DeleteApplication(It.IsAny<string>()));
|
||||
mockBlobStorageAccess.Setup(repo => repo.GetBlobAsBase64(It.IsAny<LoanApplicationFile>()))
|
||||
.Returns("dGhpcy1pcy1hLW1vY2tlZC1ibG9i");
|
||||
mockBlobStorageAccess.Setup(repo => repo.DeleteBlob(It.IsAny<LoanApplicationFile>()))
|
||||
.Returns(true);
|
||||
|
||||
// Act
|
||||
var request = new StringContent("", Encoding.UTF8, "application/json");
|
||||
var httpResponse = await _client.PostAsync("/api/LoanApplication/Submit/555-444-333", request);
|
||||
|
||||
// Must be successful.
|
||||
httpResponse.EnsureSuccessStatusCode();
|
||||
|
||||
// Deserialize and examine results.
|
||||
var stringResponse = await httpResponse.Content.ReadAsStringAsync();
|
||||
var resultApplication = JsonConvert.DeserializeObject<LoanApplication>(stringResponse);
|
||||
Assert.NotNull(resultApplication);
|
||||
Assert.Equal("{\"loanApplicationId\":\"123456789\"}", stringResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.TestHost;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Moq;
|
||||
using Serilog;
|
||||
using Xunit;
|
||||
using CRIF.ACTion.Services.Crif;
|
||||
using Landmark.OLA.Application;
|
||||
using Landmark.OLA.Application.DataAccess;
|
||||
using Landmark.OLA.Application.DataAccessLayer;
|
||||
using Landmark.OLA.Application.Services;
|
||||
using Landmark.OLA.Models.Vendor;
|
||||
using OnlineBankingAuth.Tokens;
|
||||
|
||||
namespace Landmark.OLA.Integration.Tests
|
||||
{
|
||||
public class OlaIntegrationTest : IClassFixture<CustomWebApplicationFactory<Startup>>
|
||||
{
|
||||
protected readonly HttpClient _client;
|
||||
protected readonly Mock<IBranchDataAccess> mockBranchDataAccess;
|
||||
protected readonly Mock<IConfigurationAccess> mockConfigurationAccess;
|
||||
protected readonly Mock<ICrifVendorClient> mockVendorClient;
|
||||
protected readonly Mock<ILoanApplicationDataAccess> mockLoanApplicationDataAccess;
|
||||
protected readonly Mock<IBlobStorageAccess> mockBlobStorageAccess;
|
||||
protected readonly Mock<IUspsVendorClient> mockUspsVendorClient;
|
||||
protected readonly Mock<ITokenService> mockTokenService;
|
||||
protected readonly Mock<ICoreService> mockCoreService;
|
||||
|
||||
public OlaIntegrationTest()
|
||||
{
|
||||
mockBranchDataAccess = new Mock<IBranchDataAccess>();
|
||||
mockConfigurationAccess = new Mock<IConfigurationAccess>();
|
||||
mockVendorClient = new Mock<ICrifVendorClient>();
|
||||
mockLoanApplicationDataAccess = new Mock<ILoanApplicationDataAccess>();
|
||||
mockBlobStorageAccess = new Mock<IBlobStorageAccess>();
|
||||
mockUspsVendorClient = new Mock<IUspsVendorClient>();
|
||||
mockTokenService = new Mock<ITokenService>();
|
||||
mockCoreService = new Mock<ICoreService>();
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.Enrich.FromLogContext()
|
||||
.WriteTo.Console()
|
||||
.CreateLogger();
|
||||
|
||||
var contentRoot = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "Landmark.OLA.Application"));
|
||||
|
||||
var host = new HostBuilder()
|
||||
.ConfigureAppConfiguration((context, config) =>
|
||||
{
|
||||
config.Sources.Clear();
|
||||
config.SetBasePath(contentRoot);
|
||||
config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: false);
|
||||
config.AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||
config.AddEnvironmentVariables();
|
||||
})
|
||||
.ConfigureWebHost(web =>
|
||||
{
|
||||
web.UseContentRoot(contentRoot);
|
||||
web.UseEnvironment("Development");
|
||||
web.UseStartup<Startup>();
|
||||
web.UseTestServer();
|
||||
web.ConfigureTestServices(s =>
|
||||
{
|
||||
s.AddSingleton(mockBranchDataAccess.Object);
|
||||
s.AddSingleton(mockConfigurationAccess.Object);
|
||||
s.AddSingleton(mockVendorClient.Object);
|
||||
s.AddSingleton(mockLoanApplicationDataAccess.Object);
|
||||
s.AddSingleton(mockBlobStorageAccess.Object);
|
||||
s.AddSingleton(mockUspsVendorClient.Object);
|
||||
s.AddSingleton(mockTokenService.Object);
|
||||
s.AddSingleton(mockCoreService.Object);
|
||||
});
|
||||
})
|
||||
.UseSerilog((ctx, services, lc) => lc
|
||||
.ReadFrom.Configuration(ctx.Configuration)
|
||||
.ReadFrom.Services(services)
|
||||
.Enrich.FromLogContext())
|
||||
.Build();
|
||||
|
||||
host.Start();
|
||||
|
||||
var server = host.GetTestServer();
|
||||
_client = server.CreateClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using Landmark.OLA.Models.Addresses;
|
||||
|
||||
namespace Landmark.OLA.Integration.Tests
|
||||
{
|
||||
public class SAMLAssertionControllerTest : OlaIntegrationTest
|
||||
{
|
||||
public Address testResult;
|
||||
|
||||
public SAMLAssertionControllerTest() : base()
|
||||
{
|
||||
testResult = new Address()
|
||||
{
|
||||
Address1 = "111 South First Street",
|
||||
City = "Milwaukee",
|
||||
State = Models.Addresses.Enums.StateOption.WI,
|
||||
PostalCode = "53207",
|
||||
Country = Models.Addresses.Enums.CountryOption.UnitedStates
|
||||
};
|
||||
mockUspsVendorClient.Setup(repo => repo.CompareAddress(It.IsAny<Address>()))
|
||||
.Returns(Task.FromResult(testResult));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CanInitAnonymousSession()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
// Act
|
||||
HttpResponseMessage httpResponse = await _client.GetAsync("/api/SAMLAssertionConsumer/InitSession");
|
||||
|
||||
// Must be successful.
|
||||
httpResponse.EnsureSuccessStatusCode();
|
||||
|
||||
|
||||
// Deserialize and examine results.
|
||||
var stringResponse = await httpResponse.Content.ReadAsStringAsync();
|
||||
|
||||
Assert.Equal("", stringResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Xunit;
|
||||
using Landmark.OLA.Application;
|
||||
|
||||
namespace Landmark.OLA.Integration.Tests
|
||||
{
|
||||
public class StatusControllerTest : OlaIntegrationTest
|
||||
{
|
||||
|
||||
public StatusControllerTest(): base()
|
||||
{
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CanGetStatus()
|
||||
{
|
||||
// The endpoint or route of the controller action.
|
||||
var httpResponse = await _client.GetAsync("/api/status/api/status");
|
||||
|
||||
// Must be successful.
|
||||
httpResponse.EnsureSuccessStatusCode();
|
||||
|
||||
// Deserialize and examine results.
|
||||
var stringResponse = await httpResponse.Content.ReadAsStringAsync();
|
||||
var status = JsonConvert.DeserializeObject<Status>(stringResponse);
|
||||
Assert.Equal("1.0.0.0", status.BuildVersion);
|
||||
}
|
||||
/*
|
||||
[Fact]
|
||||
public async Task CanGetRoot()
|
||||
{
|
||||
// The endpoint or route of the controller action.
|
||||
var httpResponse = await _client.GetAsync("/");
|
||||
|
||||
// Must be successful.
|
||||
Assert.Equal(HttpStatusCode.Redirect, httpResponse.StatusCode);
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Xunit;
|
||||
using Landmark.OLA.Application.Common.Domain;
|
||||
using Landmark.OLA.Models.Loan;
|
||||
|
||||
namespace Landmark.OLA.Integration.Tests
|
||||
{
|
||||
|
||||
public class UISettingsControllerTest : OlaIntegrationTest
|
||||
{
|
||||
private readonly BranchConfig _branchConfig;
|
||||
private readonly BranchNameConfig _branchNameConfig;
|
||||
private readonly StoredSettings _storedSettings;
|
||||
|
||||
public UISettingsControllerTest() : base()
|
||||
{
|
||||
_branchConfig = new BranchConfig
|
||||
{
|
||||
Id = "012345678901234567890123456789012345"
|
||||
};
|
||||
_branchNameConfig = new BranchNameConfig
|
||||
{
|
||||
Id = "912345678901234567890123456789012345"
|
||||
};
|
||||
_storedSettings = new StoredSettings
|
||||
{
|
||||
Id = "123456789012345678901234567890123456"
|
||||
};
|
||||
|
||||
mockBranchDataAccess.Setup(repo => repo.GetBranchConfig()).Returns(_branchConfig);
|
||||
mockBranchDataAccess.Setup(repo => repo.GetBranchNameConfig()).Returns(_branchNameConfig);
|
||||
mockConfigurationAccess.Setup(repo => repo.GetStoredSettings()).Returns(_storedSettings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CanGetSettings()
|
||||
{
|
||||
// The endpoint or route of the controller action.
|
||||
var httpResponse = await _client.GetAsync("/api/UISettings");
|
||||
|
||||
// Must be successful.
|
||||
httpResponse.EnsureSuccessStatusCode();
|
||||
|
||||
// Deserialize and examine results.
|
||||
var stringResponse = await httpResponse.Content.ReadAsStringAsync();
|
||||
var settings = JsonConvert.DeserializeObject<UiSettings>(stringResponse);
|
||||
Assert.NotNull(settings.BranchMapping);
|
||||
Assert.NotNull(settings.BranchNameMapping);
|
||||
Assert.Equal(_branchConfig.Id, settings.BranchMapping.Id);
|
||||
Assert.Equal(_branchNameConfig.Id, settings.BranchNameMapping.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- additional settings used during the dotnet test execution step in the azure dev ops pipeline -->
|
||||
|
||||
<RunSettings>
|
||||
|
||||
<DataCollectionRunSettings>
|
||||
<DataCollectors>
|
||||
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<Configuration>
|
||||
<CodeCoverage>
|
||||
|
||||
|
||||
<CompanyNames>
|
||||
<Exclude>
|
||||
<CompanyName>.*microsoft.*</CompanyName>
|
||||
</Exclude>
|
||||
</CompanyNames>
|
||||
|
||||
</CodeCoverage>
|
||||
</Configuration>
|
||||
</DataCollector>
|
||||
|
||||
</DataCollectors>
|
||||
</DataCollectionRunSettings>
|
||||
|
||||
</RunSettings>
|
||||
Reference in New Issue
Block a user