Skip to content

Commit

Permalink
Devops: fix action for ubuntu-latest and invariant culture in tests (#…
Browse files Browse the repository at this point in the history
…5974)

* adds invariant culture to date string. Avoiding the "seemingly same date strings fail the test ".

* Formating

---------

Co-authored-by: Mladen Macanovic <[email protected]>
  • Loading branch information
tesar-tech and stsrki authored Feb 17, 2025
1 parent 6f8ec2f commit 4ff8484
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/blazorise-ci-basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push]
jobs:
build:

runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
Expand Down
14 changes: 12 additions & 2 deletions Tests/Blazorise.Tests/DataGrid/Utils/FunctionCompilerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ public void ValueGetter_ReturnsCorrectPropertyOrField_DefaultValue( string field
{
var test = new Test();
var valueGetter = FunctionCompiler.CreateValueGetter<Test>( field );
var value = valueGetter( test );

Assert.Equal( expected, valueGetter( test )?.ToString() );
Assert.Equal( expected, value switch
{
DateTime dt => dt.ToString( "M/d/yyyy h:mm:ss tt", CultureInfo.InvariantCulture ),
_ => value?.ToString()
} );
}

[Theory]
Expand All @@ -47,8 +52,13 @@ public void ValueGetter_ReturnsCorrectPropertyOrField_ActualValue( string field,
{
var test = GetTest();
var valueGetter = FunctionCompiler.CreateValueGetter<Test>( field );
var value = valueGetter( test );

Assert.Equal( expected, valueGetter( test )?.ToString() );
Assert.Equal( expected, value switch
{
DateTime dt => dt.ToString( "M/d/yyyy h:mm:ss tt", CultureInfo.InvariantCulture ),
_ => value?.ToString()
} );
}

public FunctionCompilerTests()
Expand Down

0 comments on commit 4ff8484

Please sign in to comment.