Skip to content

Commit c1c2965

Browse files
Sync with atata-repository-template and refactor sources accordingly
1 parent b96f059 commit c1c2965

File tree

12 files changed

+449
-245
lines changed

12 files changed

+449
-245
lines changed

.editorconfig

Lines changed: 329 additions & 155 deletions
Large diffs are not rendered by default.

.gitattributes

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
* text=auto
2+
3+
*.sln text eol=crlf
4+
5+
*.csproj text eol=crlf
6+
7+
*.cs text eol=crlf
8+
*.csx text eol=crlf
9+
10+
*.props text eol=crlf
11+
*.targets text eol=crlf
12+
*.config text eol=crlf
13+
*.nuspec text eol=crlf
14+
*.resx text eol=crlf
15+
*.vsixmanifest text eol=crlf
16+
*.vstemplate text eol=crlf
17+
18+
*.xml text eol=crlf
19+
*.runsettings text eol=crlf
20+
*.json text eol=crlf
21+
*.yml text eol=crlf
22+
*.yaml text eol=crlf
23+
*.editorconfig text eol=crlf
24+
*.config text eol=crlf
25+
*.manifest text eol=crlf
26+
27+
*.md text eol=crlf
28+
29+
*.ps1 text eol=crlf
30+
*.bat text eol=crlf
31+
32+
*.html text eol=crlf
33+
*.cshtml text eol=crlf
34+
*.aspx text eol=crlf
35+
*.razor text eol=crlf
36+
37+
*.css text eol=crlf
38+
*.scss text eol=crlf
39+
*.less text eol=crlf
40+
41+
*.js text eol=crlf
42+
*.ts text eol=crlf

CONTRIBUTING.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,27 @@ Any issues or questions can also be targeted to any communication channel define
77

88
## Code Contributing
99

10+
### Development Prerequisites
11+
12+
- Visual Studio 2022 or JetBrains Raider.
13+
1014
### Setting Up For Development
1115

1216
In order to set up this project for further contributing do the following:
1317

1418
- Fork the repository.
1519
- Clone the forked repository locally.
1620
- Open `.sln` file located in the root of the repository.
17-
18-
### Development Prerequisites
19-
20-
- Visual Studio 2019 with .NET Core tools installed or JetBrains Raider.
21+
- Run tests through IDE or with `dotnet test` command.
2122

2223
### Development
2324

2425
Please follow the rules during development:
26+
2527
- Fix (or suppress in rare cases) all code analysis warnings.
2628
- Ensure that newly added public classes and members have XML documentation comments.
2729
This does not apply to classes in test projects.
2830
- Run all tests in order to ensure the changes don't break anything.
2931
- Try to add/update tests respectively.
3032
- Follow [Semantic Versioning 2.0](https://semver.org/) during the source changes.
31-
- [Create pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) when it is done.
33+
- [Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) when it is done.

Directory.Build.props

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
<Company>Yevgeniy Shunevych</Company>
66
<Product>Atata Framework</Product>
77
<Copyright>© Yevgeniy Shunevych 2022</Copyright>
8-
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)General.ruleset</CodeAnalysisRuleSet>
98
<EnableNETAnalyzers>true</EnableNETAnalyzers>
109
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
1110
<AnalysisLevel>latest</AnalysisLevel>
1211
</PropertyGroup>
1312

1413
<ItemGroup Label="Code analysis packages">
15-
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.35.0.42613" PrivateAssets="All" />
16-
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
14+
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.44.0.52574" PrivateAssets="All" />
15+
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="All" />
1716
</ItemGroup>
1817

1918
</Project>

src/Atata.HtmlValidation/Extensions/CheckExtensions.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,9 @@ message is null
104104
? new ArgumentNullException(argumentName)
105105
: new ArgumentNullException(argumentName, message);
106106

107-
private static string ConcatMessage(string primaryMessage, string secondaryMessage)
108-
{
109-
return string.IsNullOrEmpty(secondaryMessage)
107+
private static string ConcatMessage(string primaryMessage, string secondaryMessage) =>
108+
string.IsNullOrEmpty(secondaryMessage)
110109
? primaryMessage
111110
: $"{primaryMessage} {secondaryMessage}";
112-
}
113111
}
114112
}

src/Atata.HtmlValidation/GlobalSuppressions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
#pragma warning disable S103 // Lines should not be too long
44

55
[assembly: SuppressMessage("Critical Code Smell", "S2696:Instance members should not write to \"static\" fields", Justification = "<Pending>", Scope = "member", Target = "~M:Atata.HtmlValidation.HtmlValidator.EnsureCliIsInstalled")]
6+
[assembly: SuppressMessage("Style", "IDE0053:Use expression body for lambda expressions", Justification = "<Pending>", Scope = "member", Target = "~M:Atata.PageObjectHtmlValidateExtensions.ValidateHtml``1(``0,Atata.HtmlValidation.HtmlValidationOptions,System.Boolean)~``0")]
67

78
#pragma warning restore S103 // Lines should not be too long

src/Atata.HtmlValidation/ValidateHtmlAttribute.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ public ValidateHtmlAttribute(TriggerEvents on = TriggerEvents.Init, TriggerPrior
1919
/// </summary>
2020
public bool AsWarning { get; set; }
2121

22-
protected override void Execute<TOwner>(TriggerContext<TOwner> context)
23-
{
22+
protected override void Execute<TOwner>(TriggerContext<TOwner> context) =>
2423
context.Component.Owner.ValidateHtml(asWarning: AsWarning);
25-
}
2624
}
2725
}

src/icon.png

189 Bytes
Loading

test/Atata.HtmlValidation.IntegrationTests/Atata.HtmlValidation.IntegrationTests.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22

33
<PropertyGroup>
44
<TargetFramework>net6.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
56
</PropertyGroup>
67

8+
<ItemGroup>
9+
<Using Include="NUnit.Framework" />
10+
<Using Include="NUnit.Framework.Internal" />
11+
<Using Include="System.Collections" />
12+
</ItemGroup>
13+
714
<ItemGroup>
815
<PackageReference Include="Atata.WebDriverSetup" Version="2.4.0" />
916
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,52 @@
1-
using System;
2-
using System.IO;
3-
using Atata.Cli.HtmlValidate;
4-
using NUnit.Framework;
5-
using NUnit.Framework.Internal;
1+
using Atata.Cli.HtmlValidate;
62

7-
namespace Atata.HtmlValidation.IntegrationTests
3+
namespace Atata.HtmlValidation.IntegrationTests;
4+
5+
[TestFixture]
6+
public class PageObjectHtmlValidateExtensionsTests : UITestFixture
87
{
9-
[TestFixture]
10-
public class PageObjectHtmlValidateExtensionsTests : UITestFixture
11-
{
12-
[Test]
13-
public void ValidateHtml_WithoutErrors()
14-
{
15-
GoToTestPage("Errors0.html")
16-
.ValidateHtml();
17-
}
8+
[Test]
9+
public void ValidateHtml_WithoutErrors() =>
10+
GoToTestPage("Errors0.html")
11+
.ValidateHtml();
1812

19-
[Test]
20-
public void ValidateHtml_WithErrors_WithOptions()
13+
[Test]
14+
public void ValidateHtml_WithErrors_WithOptions()
15+
{
16+
var options = new HtmlValidationOptions
2117
{
22-
var options = new HtmlValidationOptions
23-
{
24-
OutputFormatter = HtmlValidateFormatter.Names.Json
25-
};
18+
OutputFormatter = HtmlValidateFormatter.Names.Json
19+
};
2620

27-
var sut = GoToTestPage("Errors1.html");
21+
var sut = GoToTestPage("Errors1.html");
2822

29-
var exception = Assert.Throws<NUnit.Framework.AssertionException>(
30-
() => sut.ValidateHtml(options));
23+
var exception = Assert.Throws<NUnit.Framework.AssertionException>(
24+
() => sut.ValidateHtml(options));
3125

32-
exception.ToResultSubject()
33-
.ValueOf(x => x.Message).Should.Contain("\"errorCount\"");
34-
}
26+
exception.ToResultSubject()
27+
.ValueOf(x => x.Message).Should.Contain("\"errorCount\"");
28+
}
3529

36-
[Test]
37-
public void ValidateHtml_WithErrors_AsWarning()
38-
{
39-
GoToTestPage("Errors1.html")
40-
.ValidateHtml(asWarning: true);
30+
[Test]
31+
public void ValidateHtml_WithErrors_AsWarning()
32+
{
33+
GoToTestPage("Errors1.html")
34+
.ValidateHtml(asWarning: true);
4135

42-
var assertionResults = TestExecutionContext.CurrentContext.CurrentResult.AssertionResults;
36+
var assertionResults = TestExecutionContext.CurrentContext.CurrentResult.AssertionResults;
4337

44-
assertionResults.ToSubject(nameof(assertionResults))
45-
.ValueOf(x => x.Count).Should.Equal(1)
46-
.ValueOf(x => x[0].Status).Should.Equal(NUnit.Framework.Interfaces.AssertionStatus.Warning);
38+
assertionResults.ToSubject(nameof(assertionResults))
39+
.ValueOf(x => x.Count).Should.Equal(1)
40+
.ValueOf(x => x[0].Status).Should.Equal(NUnit.Framework.Interfaces.AssertionStatus.Warning);
4741

48-
assertionResults.Clear();
49-
}
42+
assertionResults.Clear();
43+
}
5044

51-
private static OrdinaryPage GoToTestPage(string name)
52-
{
53-
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestPages", name);
54-
string url = "file:///" + filePath;
45+
private static OrdinaryPage GoToTestPage(string name)
46+
{
47+
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestPages", name);
48+
string url = "file:///" + filePath;
5549

56-
return Go.To<OrdinaryPage>(url: url);
57-
}
50+
return Go.To<OrdinaryPage>(url: url);
5851
}
5952
}

0 commit comments

Comments
 (0)