Skip to content

Commit

Permalink
Fixes UbiquityDotNET#7 - Hardcoded platform string text in Unit tests
Browse files Browse the repository at this point in the history
- This change simply alters the test for the exception message to verify the part provided by the Llvm.NET library itself, ignoring the trailing part provided by the  BCL, which is subject to Locale differences.
- Appveyor.yml is set to run test in a second locale to help catch any future issues.
  • Loading branch information
smaillet committed Oct 13, 2017
1 parent 424a487 commit 0c3c3b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ after_build:

test_script:
- ps: .\Invoke-UnitTests.ps1
- ps: { Set-Culture fr-FR; .\Invoke-UnitTests.ps1 }

artifacts:
- path: .\BuildOutput\Nuget\LLvm.NET.*.nupkg
Expand Down
8 changes: 3 additions & 5 deletions src/Llvm.NETTests/ExpectedArgumentException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ protected override void Verify( Exception exception )
RethrowIfAssertException(exception);

Assert.IsInstanceOfType(exception, typeof(ArgumentException), WrongExceptionMessage );
Assert.AreEqual( ExpectedName, ( ( ArgumentException )exception ).ParamName );
var argException = ( ArgumentException )exception;
Assert.AreEqual( ExpectedName, argException.ParamName );
if( !string.IsNullOrWhiteSpace( ExpectedExceptionMessage ) )
{
Assert.AreEqual( $"{ExpectedExceptionMessage}\r\nParameter name: {ExpectedName}"
, exception.Message
, "Could not verify the exception message."
);
Assert.IsTrue( exception.Message.StartsWith( ExpectedExceptionMessage, StringComparison.Ordinal ), "Could not verify the exception message." );
}
}

Expand Down

0 comments on commit 0c3c3b0

Please sign in to comment.