Skip to content

Commit

Permalink
test(config): fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyTWF committed Jan 30, 2021
1 parent 3cf265e commit c7b45a7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/CompilerTest/Config/ConfigFileLoaderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ public class ConfigFileLoaderTest

public ConfigFileLoaderTest()
{
this.fileLoader = ConfigFileLoaderFactory.Make();
this.arguments = new CompilerArguments();
fileLoader = ConfigFileLoaderFactory.Make();
arguments = new CompilerArguments();
}

[Theory]
[InlineData("xyz", "Config file not found")]
[InlineData("_TestData/ConfigFileLoader/InvalidJson/config.json", "Invalid JSON in _TestData/ConfigFileLoader/InvalidJson/config.json: Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1.")]
[InlineData("_TestData/ConfigFileLoader/NotObject/config.json", "Invalid JSON in _TestData/ConfigFileLoader/NotObject/config.json: Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1.")]
[InlineData("_TestData/ConfigFileLoader/InvalidJson/config.json", "Invalid JSON in .*?: Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray\\. Path '', line 1, position 1\\.")]
[InlineData("_TestData/ConfigFileLoader/NotObject/config.json", "Invalid JSON in .*?: Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray\\. Path '', line 1, position 1\\.")]
public void TestItThrowsExceptionOnBadData(string fileToLoad, string expectedMessage)
{
ConfigFileInvalidException exception = Assert.Throws<ConfigFileInvalidException>(
() => fileLoader.LoadConfigFiles(new List<string> {fileToLoad}, this.arguments)
() => fileLoader.LoadConfigFiles(new List<string> {fileToLoad}, arguments)
);
Assert.Equal(expectedMessage, exception.Message);
Assert.Matches(expectedMessage, exception.Message);
}

private string GetFullFilePath(string relative)
Expand All @@ -42,7 +42,7 @@ private string GetFullFilePath(string relative)
public void TestItLoadsAConfigFile()
{
ConfigInclusionRules rules = fileLoader.LoadConfigFiles(
new List<string> {"_TestData/ConfigFileLoader/ValidConfig/config.json"}, this.arguments
new List<string> {"_TestData/ConfigFileLoader/ValidConfig/config.json"}, arguments
);

List<IInclusionRule> ruleList = rules.ToList();
Expand Down

0 comments on commit c7b45a7

Please sign in to comment.