Skip to content

Commit

Permalink
Merge pull request #44 from kysect/feat/code-style-generator
Browse files Browse the repository at this point in the history
Add asserts for test on code style generation
  • Loading branch information
FrediKats authored Sep 2, 2023
2 parents f39476b + c02d8cd commit 85970b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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>();
CodeStyleRoslynStyleRuleConfiguration roslynStyleRuleConfiguration = codeStyleElement.To<CodeStyleRoslynStyleRuleConfiguration>();
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");
}
}
3 changes: 1 addition & 2 deletions Sources/Kysect.Configuin.Tests/Tools/TestImplementations.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 85970b6

Please sign in to comment.