From c02d8cdaa60cb9e0afd28dd43087570cd3d8875b Mon Sep 17 00:00:00 2001 From: Fredi Kats Date: Sat, 2 Sep 2023 16:38:43 +0400 Subject: [PATCH] Add asserts for test on code style generation --- .../CodeStyleGeneration/CodeStyleGeneratorTests.cs | 14 +++++++++++--- .../Tools/TestImplementations.cs | 3 +-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Sources/Kysect.Configuin.Tests/CodeStyleGeneration/CodeStyleGeneratorTests.cs b/Sources/Kysect.Configuin.Tests/CodeStyleGeneration/CodeStyleGeneratorTests.cs index 30ff859..d40ecdb 100644 --- a/Sources/Kysect.Configuin.Tests/CodeStyleGeneration/CodeStyleGeneratorTests.cs +++ b/Sources/Kysect.Configuin.Tests/CodeStyleGeneration/CodeStyleGeneratorTests.cs @@ -1,4 +1,6 @@ -using Kysect.Configuin.Core.MsLearnDocumentation.Models; +using FluentAssertions; +using Kysect.CommonLib.BaseTypes.Extensions; +using Kysect.Configuin.Core.MsLearnDocumentation.Models; using Kysect.Configuin.Core.MsLearnDocumentation; using Kysect.Configuin.Core.RoslynRuleModels; using Kysect.Configuin.Core.EditorConfigParsing; @@ -28,7 +30,13 @@ public void Generate_ForAllMsLearnDocumentation_FinishWithoutErrors() CodeStyle codeStyle = sut.Generate(editorConfigSettings, roslynRules); - // TODO: add asserts - Assert.Pass(); + ICodeStyleElement codeStyleElement = codeStyle.Elements.ElementAt(2); + codeStyleElement.Should().BeOfType(); + CodeStyleRoslynStyleRuleConfiguration roslynStyleRuleConfiguration = codeStyleElement.To(); + roslynStyleRuleConfiguration.Severity.Should().Be(RoslynRuleSeverity.Warning); + roslynStyleRuleConfiguration.Rule.RuleId.Should().Be(RoslynRuleId.Parse("IDE0003")); + roslynStyleRuleConfiguration.Options.Should().HaveCount(4); + roslynStyleRuleConfiguration.Options.ElementAt(0).Option.Name.Should().Be("dotnet_style_qualification_for_field"); + roslynStyleRuleConfiguration.Options.ElementAt(0).SelectedValue.Should().Be("false:warning"); } } \ No newline at end of file diff --git a/Sources/Kysect.Configuin.Tests/Tools/TestImplementations.cs b/Sources/Kysect.Configuin.Tests/Tools/TestImplementations.cs index 1c03d4e..577d639 100644 --- a/Sources/Kysect.Configuin.Tests/Tools/TestImplementations.cs +++ b/Sources/Kysect.Configuin.Tests/Tools/TestImplementations.cs @@ -1,5 +1,4 @@ -using Kysect.Configuin.Core.MarkdownParsing; -using Kysect.Configuin.Core.MarkdownParsing.TextExtractor; +using Kysect.Configuin.Core.MarkdownParsing.TextExtractor; using Kysect.Configuin.Core.MsLearnDocumentation; namespace Kysect.Configuin.Tests.Tools;