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

ISSUE-158&159 #160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
ISSUE-158&159
Ilya Nemtsev authored and Ilya Nemtsev committed Jun 23, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit f9eea9f57fa6b1ede7a039b28577382a91f2b6f3
1 change: 1 addition & 0 deletions src/Agoda.Analyzers.Test/Agoda.Analyzers.Test.csproj
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@
<ProjectReference Include="..\Agoda.Analyzers\Agoda.Analyzers.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.3" />
<PackageReference Include="Microsoft.AspNet.Razor" Version="3.2.3" />
<PackageReference Include="Microsoft.AspNet.WebPages" Version="3.2.3" />
35 changes: 35 additions & 0 deletions src/Agoda.Analyzers.Test/AgodaCustom/AG0012UnitTests.cs
Original file line number Diff line number Diff line change
@@ -184,5 +184,40 @@ void helper(int i)

await VerifyDiagnosticsAsync(code, EmptyDiagnosticResults);
}

[Test]
public async Task AG0012_WithFluentAssertions_ShouldNotShowWarning()
{
var code = new CodeDescriptor
{
References = new[] { typeof(TestFixtureAttribute).Assembly, typeof(FluentAssertions.NumericAssertionsExtensions).Assembly },
Code = @"
using NUnit.Framework;
using FluentAssertions;
using System;
namespace Tests
{
public class TestClass
{
[Test]
public void This_Is_Valid()
{
int[] arrayForShouldBe = { 1, 2, 3 };
arrayForShouldBe.Length.Should().Be(3);
}
[Test]
public void This_Is_AlsoValid()
{
var act = () => var y = 1;
act.Should().Throw<Exception>();
}
}
}"
};

await VerifyDiagnosticsAsync(code, EmptyDiagnosticResults);
}
}
}
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@ private static readonly LocalizableString Description
{
new AssertLibraryInfo("NUnit.Framework", "nunit.framework.dll", "Assert"),
new AssertLibraryInfo("Shouldly", "Shouldly.dll", "Should", "Shouldly.Should"),
new AssertLibraryInfo("FluentAssertions", "FluentAssertions.dll", "Should", "FluentAssertions.NumericAssertionsExtensions"),
};

public override void Initialize(AnalysisContext context)

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Agoda.Analyzers/AgodaCustom/CustomRulesResources.resx
Original file line number Diff line number Diff line change
@@ -201,7 +201,7 @@
<value>Ensure that publicly exposed IEnumerable types</value>
</data>
<data name="AG0026Title" xml:space="preserve">
<value>Use only CSS Selectors to find elements in Selenium tests</value>
<value>Use only CSS Selectors to find elements in Selenium tests (preferrably use [data-selenium] attributes)</value>
</data>
<data name="AG0010Title" xml:space="preserve">
<value>Prevent test fixture inheritance</value>