Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add asserts for test on code style generation #44

Merged
merged 1 commit into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading