private void TestConfig(StylerOptions stylerOptions, string expectedConfiguration) { var actualOptions = JsonConvert.SerializeObject(stylerOptions); var expectedOptions = File.ReadAllText(Tests.GetConfiguration(expectedConfiguration)); Assert.That(Regex.Replace(actualOptions, @"\s+", ""), Is.EqualTo(Regex.Replace(expectedOptions, @"\s+", ""))); }
public void TestConfigurationDefault() { var stylerOptions = new StylerOptions(config: Tests.GetConfiguration(@"TestConfigurations\Default.json")); this.TestConfig(stylerOptions, @"TestConfigurations\SerializedDefault.json"); Assert.IsTrue(stylerOptions.UseVisualStudioIndentWithTabs); }
public void TestConfigurationIndentUsingTabs() { var stylerOptions = new StylerOptions(config: Tests.GetConfiguration(@"TestConfigurations\IndentWithTabsOverride.json")); this.TestConfig(stylerOptions, @"TestConfigurations\IndentWithTabsOverride.json"); Assert.IsFalse(stylerOptions.UseVisualStudioIndentWithTabs); // IndentWithTabs is true Assert.IsFalse(stylerOptions.UseVisualStudioIndentSize); // IndentSize is set }
public void TestConfigurationAllDifferent() { var stylerOptions = new StylerOptions(config: Tests.GetConfiguration(@"TestConfigurations\AllDifferent.json")); this.TestConfig(stylerOptions, @"TestConfigurations\AllDifferent.json"); }
public void TestConfigurationBadSetting() { var stylerOptions = new StylerOptions(config: Tests.GetConfiguration(@"TestConfigurations\BadSetting.json")); this.TestConfig(stylerOptions, @"TestConfigurations\SerializedDefault.json"); }
public void TestConfigurationSingle() { var stylerOptions = new StylerOptions(config: Tests.GetConfiguration(@"TestConfigurations\Single.json")); this.TestConfig(stylerOptions, @"TestConfigurations\Single.json"); }
public void TestConfigurationEmpty() { var stylerOptions = new StylerOptions(config: Tests.GetConfiguration(@"TestConfigurations\Empty.json")); this.TestConfig(stylerOptions, @"TestConfigurations\SerializedDefault.json"); }