Пример #1
0
        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+", "")));
        }
Пример #2
0
        public void TestConfigurationDefault()
        {
            var stylerOptions = new StylerOptions(config: Tests.GetConfiguration(@"TestConfigurations\Default.json"));

            this.TestConfig(stylerOptions, @"TestConfigurations\SerializedDefault.json");

            Assert.IsTrue(stylerOptions.UseVisualStudioIndentWithTabs);
        }
Пример #3
0
        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
        }
Пример #4
0
        public void TestConfigurationAllDifferent()
        {
            var stylerOptions = new StylerOptions(config: Tests.GetConfiguration(@"TestConfigurations\AllDifferent.json"));

            this.TestConfig(stylerOptions, @"TestConfigurations\AllDifferent.json");
        }
Пример #5
0
        public void TestConfigurationBadSetting()
        {
            var stylerOptions = new StylerOptions(config: Tests.GetConfiguration(@"TestConfigurations\BadSetting.json"));

            this.TestConfig(stylerOptions, @"TestConfigurations\SerializedDefault.json");
        }
Пример #6
0
        public void TestConfigurationSingle()
        {
            var stylerOptions = new StylerOptions(config: Tests.GetConfiguration(@"TestConfigurations\Single.json"));

            this.TestConfig(stylerOptions, @"TestConfigurations\Single.json");
        }
Пример #7
0
        public void TestConfigurationEmpty()
        {
            var stylerOptions = new StylerOptions(config: Tests.GetConfiguration(@"TestConfigurations\Empty.json"));

            this.TestConfig(stylerOptions, @"TestConfigurations\SerializedDefault.json");
        }