Skip to content

Commit df689e2

Browse files
author
Jani Giannoudis
committed
updated to version 0.5.0-beta.10.
1 parent cc6c18c commit df689e2

File tree

7 files changed

+33
-11
lines changed

7 files changed

+33
-11
lines changed

Client.Test/Case/CaseBuildTestRunner.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Globalization;
34
using System.Linq;
45
using System.Net.Http;
56
using System.Threading.Tasks;
@@ -12,12 +13,15 @@ namespace PayrollEngine.Client.Test.Case;
1213
/// </summary>
1314
public class CaseBuildTestRunner : CaseScriptTestRunner
1415
{
16+
private CultureInfo Culture { get; }
17+
1518
/// <summary>new instance of <see cref="CaseValidateTestRunner"/>see</summary>
1619
/// <param name="httpClient">The payroll http client</param>
1720
/// <param name="context">The test context</param>
1821
public CaseBuildTestRunner(PayrollHttpClient httpClient, CaseTestContext context) :
1922
base(httpClient, context)
2023
{
24+
Culture = CultureTool.GetTenantCulture(Tenant);
2125
}
2226

2327
/// <summary>Test the case validation</summary>
@@ -144,8 +148,8 @@ protected virtual List<CaseScriptTestResult> CompareCase(string testName, CaseSe
144148
caseField.ValueType = actualCaseField.ValueType;
145149

146150
// case value
147-
var expectedValue = caseField.GetValue();
148-
var actualValue = actualCaseField.GetValue();
151+
var expectedValue = caseField.GetValue(Culture);
152+
var actualValue = actualCaseField.GetValue(Culture);
149153
if (!Equals(expectedValue, actualValue))
150154
{
151155
results.Add(NewFailedResult(CaseTestType.CaseBuild, testName,

Client.Test/Case/CaseCustomTest.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Globalization;
34
using System.Linq;
45
using PayrollEngine.Client.Model;
56
using PayrollEngine.Client.Service.Api;
@@ -9,6 +10,8 @@ namespace PayrollEngine.Client.Test.Case;
910
/// <summary>Case custom test class</summary>
1011
public abstract class CaseCustomTest : CustomTestBase<CaseTestContext>
1112
{
13+
private CultureInfo Culture { get; }
14+
1215
/// <summary>The payroll</summary>
1316
public Payroll Payroll => Context.Payroll;
1417

@@ -27,6 +30,7 @@ public abstract class CaseCustomTest : CustomTestBase<CaseTestContext>
2730
protected CaseCustomTest(PayrollHttpClient httpClient, CaseTestContext context) :
2831
base(httpClient, context)
2932
{
33+
Culture = CultureTool.GetTenantCulture(Tenant);
3034
}
3135

3236
#region Cases
@@ -104,7 +108,7 @@ protected CaseFieldValue GetCasePeriodValue(string caseFieldName) =>
104108
protected T GetCasePeriodValue<T>(string caseFieldName)
105109
{
106110
var caseValue = GetCasePeriodValue(caseFieldName);
107-
return caseValue != null ? (T)ValueConvert.ToValue(caseValue.Value, caseValue.ValueType) : default;
111+
return caseValue != null ? (T)ValueConvert.ToValue(caseValue.Value, caseValue.ValueType, Culture) : default;
108112
}
109113

110114
/// <summary>Get case raw values</summary>

Client.Test/PayrollEngine.Client.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<ItemGroup>
1919
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.6.0" />
20-
<PackageReference Include="PayrollEngine.Client.Core" Version="0.6.0-beta.9" />
20+
<PackageReference Include="PayrollEngine.Client.Core" Version="0.6.0-beta.10" />
2121
</ItemGroup>
2222

2323
<!-- include xml documention files and json schemas to the nuget package -->

Client.Test/PayrollEngine.Client.Test.xml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
using PayrollEngine.Client.Model;
1+
using System;
2+
using System.Globalization;
3+
using PayrollEngine.Client.Model;
24

35
namespace PayrollEngine.Client.Test.Payrun;
46

57
/// <summary>Payrun test result</summary>
68
public class PayrunTestResult : TestResultBase<PayrunResult>
79
{
10+
/// <summary>The test culture</summary>
11+
public CultureInfo Culture { get; set; }
12+
813
/// <summary>Initializes a new instance of the <see cref="PayrunTestResult"/> class</summary>
14+
/// <param name="culture">The culture</param>
915
/// <param name="expectedResult">The expected result</param>
1016
/// <param name="actualResult">The actual result</param>
11-
public PayrunTestResult(PayrunResult expectedResult, PayrunResult actualResult = null) :
17+
public PayrunTestResult(CultureInfo culture, PayrunResult expectedResult, PayrunResult actualResult = null) :
1218
base(expectedResult, actualResult)
1319
{
20+
Culture = culture ?? throw new ArgumentNullException(nameof(culture));
1421
}
1522

1623
/// <inheritdoc />
@@ -21,8 +28,8 @@ public override bool IsValidResult()
2128
return false;
2229
}
2330

24-
var expectedValue = ValueConvert.ToValue(ExpectedResult.Value, ExpectedResult.ValueType);
25-
var actualValue = ValueConvert.ToValue(ActualResult.Value, ActualResult.ValueType);
31+
var expectedValue = ValueConvert.ToValue(ExpectedResult.Value, ExpectedResult.ValueType, Culture);
32+
var actualValue = ValueConvert.ToValue(ActualResult.Value, ActualResult.ValueType, Culture);
2633
return Equals(expectedValue, actualValue);
2734
}
2835
}

Client.Test/Payrun/PayrunTestRunnerBase.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ protected virtual async Task<IList<PayrollTestResult>> TestPayrunJobAsync(Exchan
4343
return testResults;
4444
}
4545

46+
// culture
47+
var culture = CultureTool.GetTenantCulture(tenant);
48+
4649
// compare all payroll results values with the provided values
4750
foreach (var payrollResult in tenant.PayrollResults)
4851
{
@@ -229,7 +232,7 @@ protected virtual async Task<IList<PayrollTestResult>> TestPayrunJobAsync(Exchan
229232
Date.SameSecond(x.Start, payrunResult.Start) &&
230233
Date.SameSecond(x.End, payrunResult.End) &&
231234
CompareTool.EqualLists(x.Tags, payrunResult.Tags));
232-
var result = new PayrunTestResult(payrunResult, actualResult);
235+
var result = new PayrunTestResult(culture, payrunResult, actualResult);
233236
testResult.PayrunResults.Add(result);
234237
}
235238
}

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net7.0</TargetFramework>
5-
<Version>0.6.0-beta.9</Version>
5+
<Version>0.6.0-beta.10</Version>
66
<FileVersion>0.6.0</FileVersion>
77
<InformationalVersion></InformationalVersion>
88
<Authors>Jani Giannoudis</Authors>

0 commit comments

Comments
 (0)