Skip to content

Commit

Permalink
TECH-3764 Fix unit tests and resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AliArmanLMG committed Sep 17, 2024
1 parent 593cf4f commit f05e86b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
],
"BusinessChannel": {
"BusinessNumber": "",
"CompanyName": "cha cwufuztrz",
"CompanyName": "rtx kebwpjmil",
"CompanyNumber": null,
"Contact": {
"ContactPerson": null,
Expand All @@ -350,10 +350,10 @@
"OfficePhone": {
"CountryCode": null,
"DialingCode": null,
"Number": "7080 685 554",
"Number": "8385 353 012",
"OverseasDialingCode": null
},
"WebAddress": "uyrib://sle.nfn.ket.gy",
"WebAddress": "zpvik://eov.zkn.zda.qb",
"X_Address": null
},
"CRMReferenceNumber": null,
Expand Down Expand Up @@ -443,7 +443,7 @@
"Age": 17,
"DateOfBirth": "2007-04-19T00:00:00",
"FinancialProvider": null,
"Name": "Ruby Bruce ",
"Name": "fuvn kuoua ",
"SequenceNumber": null,
"UniqueID": "Person_9970620"
}
Expand Down Expand Up @@ -514,7 +514,7 @@
"TotalSystemCalculatedLivingExpenses": null,
"TotalUserStatedLivingExpenses": null
},
"Name": null,
"Name": "",
"NumberOfAdults": 2,
"NumberOfDependants": 1,
"SequenceNumber": null,
Expand Down Expand Up @@ -1896,7 +1896,7 @@
},
"EmailAddress": [
{
"Email": "vmssw@sovuxtiivgracdwccclswbntsrs.kn",
"Email": "xjubs@lvgpeywbirlihimmvfmtrnetjcj.in",
"EmailType": "Home",
"SequenceNumber": null,
"UniqueID": null
Expand All @@ -1907,7 +1907,7 @@
"Mobile": {
"CountryCode": "61",
"DialingCode": "04",
"Number": "1648410042",
"Number": "7025243478",
"OverseasDialingCode": null
},
"PostSettlementAddress": null,
Expand Down Expand Up @@ -2269,7 +2269,7 @@
},
"EmailAddress": [
{
"Email": "fvaesyzfdfzk@uvhbaxj.ysm",
"Email": "lhtvwcslrvml@pwixccl.jaw",
"EmailType": "Home",
"SequenceNumber": null,
"UniqueID": null
Expand All @@ -2280,7 +2280,7 @@
"Mobile": {
"CountryCode": "61",
"DialingCode": "04",
"Number": "6368131462",
"Number": "7353251870",
"OverseasDialingCode": null
},
"PostSettlementAddress": null,
Expand Down Expand Up @@ -2774,10 +2774,10 @@
"Beneficiary": null,
"BusinessName": "PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXD",
"BusinessNameSameAsCompanyName": null,
"BusinessNumber": "58186426373",
"BusinessNumber": "78437188876",
"BusinessNumberVerified": null,
"BusinessStructure": "Sole Trader",
"CompanyName": "uldwzgrvnohvmidbtyvuuszvblrexwhkckpeswpcszhd",
"CompanyName": "bbmxzfbtgjgkwmzvuiprqkvlevdjayvapwnyxgkzsiel",
"CompanyNumber": null,
"Contact": {
"ContactPerson": {
Expand All @@ -2793,7 +2793,7 @@
"OfficePhone": {
"CountryCode": null,
"DialingCode": null,
"Number": "70777234662",
"Number": "10012668677",
"OverseasDialingCode": null
},
"TradingAddress": null,
Expand Down Expand Up @@ -2834,7 +2834,7 @@
"BusinessNumber": "",
"BusinessNumberVerified": null,
"BusinessStructure": null,
"CompanyName": "wwhiedmrbtjulv",
"CompanyName": "qasagbbthbofhb",
"CompanyNumber": null,
"Contact": {
"ContactPerson": {
Expand All @@ -2850,7 +2850,7 @@
"OfficePhone": {
"CountryCode": null,
"DialingCode": null,
"Number": "yfsrkkuicw6",
"Number": "jqpermhmgu2",
"OverseasDialingCode": null
},
"TradingAddress": null,
Expand Down Expand Up @@ -2887,7 +2887,7 @@
"Mobile": {
"CountryCode": null,
"DialingCode": null,
"Number": "76226724061",
"Number": "54684868311",
"OverseasDialingCode": null
},
"PreferredContact": null,
Expand Down Expand Up @@ -2921,7 +2921,7 @@
"Mobile": {
"CountryCode": null,
"DialingCode": null,
"Number": "qgdxctbzgl0",
"Number": "veguwoifdw2",
"OverseasDialingCode": null
},
"PreferredContact": null,
Expand Down Expand Up @@ -2950,15 +2950,15 @@
"SalesChannel": {
"Aggregator": {
"AccreditationNumber": null,
"BusinessNumber": "31416015855",
"BusinessNumber": "32875641150",
"CompanyName": "",
"Contact": {
"Email": "ylfrdbesehprwrr@xuwqvlgyee.nhp.sy",
"Email": "ggbpezwnskpgwca@tcuckxoxxn.gvw.hp",
"OfficeFax": null,
"OfficePhone": {
"CountryCode": null,
"DialingCode": null,
"Number": "3277 082 064 (awlt xthr)",
"Number": "3071 117 306 (betu gmnh)",
"OverseasDialingCode": null
},
"WebAddress": "",
Expand All @@ -2976,8 +2976,8 @@
"BSB": null,
"BusinessName": null,
"BusinessNameSameAsCompanyName": null,
"BusinessNumber": "22214823171",
"CompanyName": "gyklgvtrl uiabftg nyl bpy",
"BusinessNumber": "38475414227",
"CompanyName": "ffxjutkwu tbiiixp gem lgr",
"Contact": null,
"CRMReferenceNumber": null,
"LicenceNumber": "475676",
Expand All @@ -2989,7 +2989,7 @@
"LoanWriter": {
"AccreditationNumber": "AO10348",
"Contact": {
"Email": "ptpliq@lpoocnwmuiyif.sq",
"Email": "hbamik@ysxhhcxsigaxb.fb",
"Fax": {
"CountryCode": null,
"DialingCode": null,
Expand All @@ -2999,13 +2999,13 @@
"Mobile": {
"CountryCode": null,
"DialingCode": null,
"Number": "5742862088",
"Number": "2533601653",
"OverseasDialingCode": null
},
"OfficePhone": {
"CountryCode": null,
"DialingCode": null,
"Number": "5815028765",
"Number": "0251788048",
"OverseasDialingCode": null
},
"WebAddress": "",
Expand Down Expand Up @@ -3205,7 +3205,7 @@
"ImminentlyRetiring": false,
"IntendedRetirementAge": 30,
"IntendedRetirementAgeDetails": null,
"Name": null,
"Name": "",
"Number": "",
"RepaymentOptions": {
"AllRepaymentStrategiesConsidered": null,
Expand Down Expand Up @@ -3245,7 +3245,7 @@
"ImminentlyRetiring": false,
"IntendedRetirementAge": 51,
"IntendedRetirementAgeDetails": null,
"Name": null,
"Name": "",
"Number": "",
"RepaymentOptions": {
"AllRepaymentStrategiesConsidered": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,54 +11,15 @@

public class LixiPackageServiceTests
{
private readonly Mock<ILixiPackageService> _sut;
private readonly LixiPackageService _lixiPackageService;
private readonly LixiPackageService _sut;
private readonly string _basePackagePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LixiPackageSamples");

public LixiPackageServiceTests()
{
// Create a mock for ILixiPackageService
_sut = new Mock<ILixiPackageService>();

// Create an instance of LixiPackageService
_lixiPackageService = new LixiPackageService();
}

[Fact]
public async Task CreatePackageAsync_ShouldSetCorrectValues()
{
// Arrange
var lodgementInformation = new SampleLodgementInformation
{
LoanId = 12345,
Scenario = LoanApplicationScenario.NewLoanApplication
};

var package = new Package
{
ProductionData = true,
Content = new PackageContent
{
Application = new Application
{
Overview = new Overview(),
UniqueID = ""
}
}
};

// Mock the GetPackageAsync method to return a predefined package
_sut.Setup(service => service.GetPackageAsync(It.IsAny<LoanApplicationScenario>(), It.IsAny<CancellationToken>()))
.ReturnsAsync(package);

// Act
var result = await _lixiPackageService.CreatePackageAsync(lodgementInformation);

// Assert
Assert.False(result.ProductionData);
Assert.Equal(lodgementInformation.LoanId.ToString(), result.Content.Application.Overview.BrokerApplicationReferenceNumber);
Assert.Equal($"LoanScenario-{lodgementInformation.LoanId}", result.Content.Application.UniqueID);
_sut = new LixiPackageService();
}


[Fact]
public async Task GetPackageAsync_ShouldReturnPackageFromFile()
Expand All @@ -83,12 +44,12 @@ public async Task GetPackageAsync_ShouldReturnPackageFromFile()
File.WriteAllText(packagePath, jsonContent);

// Act
var result = await _lixiPackageService.GetPackageAsync(scenario);
var result = await _sut.GetPackageAsync(scenario);

// Assert
Assert.NotNull(result);
Assert.Equal(packageContent.UniqueID, result.UniqueID);

// Clean up the file
File.Delete(packagePath);
}
Expand All @@ -115,7 +76,7 @@ public async Task SavePackageAsync_ShouldWritePackageToFile()
var packagePath = Path.Combine(_basePackagePath, fileName);

// Act
await _lixiPackageService.SavePackageAsync(package, scenario);
await _sut.SavePackageAsync(package, scenario);

// Assert
Assert.True(File.Exists(packagePath));
Expand All @@ -124,7 +85,7 @@ public async Task SavePackageAsync_ShouldWritePackageToFile()
var savedPackage = JsonConvert.DeserializeObject<Package>(fileContent);

Assert.Equal(package.Content.Application.SalesChannel.Aggregator.CompanyName, savedPackage.Content.Application.SalesChannel.Aggregator.CompanyName);

// Clean up the file
File.Delete(packagePath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace MyCRM.Lodgement.Sample.Services.LixiPackage;
public class LixiPackageService : ILixiPackageService
{
private readonly string _packagSamplesBasePath =Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LixiPackageSamples");
private readonly string[] _propertiesToObfuscate = { "CompanyName", "Email", "Number", "ABN", "WebAddress", "BusinessNumber" };
private readonly string[] _propertiesToObfuscate = { "CompanyName", "Email", "Number", "ABN", "WebAddress", "BusinessNumber", "Name" };
public async Task<Package> CreatePackageAsync(SampleLodgementInformation lodgementInformation,
CancellationToken token = default)
{
Expand Down

0 comments on commit f05e86b

Please sign in to comment.