Skip to content

Commit

Permalink
slightly improved tests by using InvariantCulture for comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
salaros committed Jun 12, 2018
1 parent f6283fb commit c691958
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions tests/SharedParameterFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static SharedParameterFileTests()
[Fact]
public void ValidFilesPassValidation()
{
Assert.All(SharedParameterFiles.Where(f => f.StartsWith(PathToValidFiles)),
Assert.All(SharedParameterFiles.Where(f => f.StartsWith(PathToValidFiles, StringComparison.InvariantCulture)),
sharedParamFilePath =>
{
var sharedParamFile = new SharedParameterFile(sharedParamFilePath);
Expand All @@ -45,7 +45,7 @@ public void ValidFilesPassValidation()
[Fact]
public void InvalidFilesFailValidation()
{
Assert.All(SharedParameterFiles.Where(f => f.StartsWith(PathToInvalidFiles)),
Assert.All(SharedParameterFiles.Where(f => f.StartsWith(PathToInvalidFiles, StringComparison.InvariantCulture)),
sharedParamFilePath =>
{
var sharedParamFile = new SharedParameterFile(sharedParamFilePath);
Expand Down Expand Up @@ -184,7 +184,7 @@ public void GroupsAreParsedCorrectly()
[Fact]
public void ClonedAndRandomizedFilesAreEqual()
{
Assert.All(SharedParameterFiles.Where(f => f.StartsWith(PathToValidFiles)),
Assert.All(SharedParameterFiles.Where(f => f.StartsWith(PathToValidFiles, StringComparison.InvariantCulture)),
sharedParamFilePath =>
{
var sharedParamFile1 = new SharedParameterFile(sharedParamFilePath);
Expand All @@ -200,7 +200,7 @@ public void ClonedAndRandomizedFilesAreEqual()
[Fact]
public void ToStringOutputCopyIsEqual()
{
Assert.All(SharedParameterFiles.Where(f => f.StartsWith(PathToValidFiles)),
Assert.All(SharedParameterFiles.Where(f => f.StartsWith(PathToValidFiles, StringComparison.InvariantCulture)),
sharedParamFilePath =>
{
var sharedParamFile1 = new SharedParameterFile(sharedParamFilePath);
Expand All @@ -218,7 +218,7 @@ public void ToStringOutputCopyIsEqual()
public void FileIsSerializedProperly()
{
var simpleSharedFromDisk = File
.ReadAllText(SharedParameterFiles.FirstOrDefault(f => f.EndsWith(@"SimpleShared_1.txt")));
.ReadAllText(SharedParameterFiles.FirstOrDefault(f => f.EndsWith(@"SimpleShared_1.txt", StringComparison.InvariantCulture)));

var simpleSharedFromBuilt = new SharedParameterFile(new Dictionary<string,int> { { "Identity Data", 100 } } );

Expand Down
6 changes: 3 additions & 3 deletions tests/TypeCatalogFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static TypeCatalogFileTests()
[Fact]
public void CheckIfNumberOfParametersIsCorrect()
{
Assert.All(CatalogTypeFiles.Where(f => f.StartsWith(PathToValidFiles)),
Assert.All(CatalogTypeFiles.Where(f => f.StartsWith(PathToValidFiles, StringComparison.InvariantCulture)),
catalogTypeFilePath =>
{
var catalogTypeFile = new TypeCatalogFile(catalogTypeFilePath);
Expand All @@ -40,7 +40,7 @@ public void CheckIfNumberOfParametersIsCorrect()
[Fact]
public void CheckIfNumberOfTypesIsCorrect()
{
Assert.All(CatalogTypeFiles.Where(f => f.StartsWith(PathToValidFiles)),
Assert.All(CatalogTypeFiles.Where(f => f.StartsWith(PathToValidFiles, StringComparison.InvariantCulture)),
catalogTypeFilePath =>
{
var catalogTypeFile = new TypeCatalogFile(catalogTypeFilePath);
Expand Down Expand Up @@ -95,7 +95,7 @@ public void iPhoneCatalogReadAndBuiltAreEqual()
var catalogTypeFileFromBuilt = catalogTypeFile.ToString();
Assert.True(!string.IsNullOrWhiteSpace(catalogTypeFileFromBuilt));

var iPhoneCatalogFilePath = CatalogTypeFiles.FirstOrDefault(f => f.EndsWith(@"iPhone6.txt"));
var iPhoneCatalogFilePath = CatalogTypeFiles.FirstOrDefault(f => f.EndsWith(@"iPhone6.txt", StringComparison.InvariantCulture));
var iPhoneCatalogFromDisk = File.ReadAllText(iPhoneCatalogFilePath);
Assert.True(File.Exists(iPhoneCatalogFilePath) && !string.IsNullOrWhiteSpace(iPhoneCatalogFromDisk));

Expand Down

0 comments on commit c691958

Please sign in to comment.