Skip to content

Commit

Permalink
Merge pull request #3371 from icsharpcode/fix/fabegone
Browse files Browse the repository at this point in the history
Switch from FA to Shouldly
  • Loading branch information
siegfriedpammer authored Jan 16, 2025
2 parents 7218a63 + 4137a04 commit 15d8ed1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<PackageVersion Include="DataGridExtensions" Version="2.6.0" />
<PackageVersion Include="DiffLib" Version="2025.0.0" />
<PackageVersion Include="Dirkster.AvalonDock.Themes.VS2013" Version="4.72.1" />
<PackageVersion Include="FluentAssertions" Version="7.0.0" /><!-- License change from 7 to 8, we need to stay on 7 -->
<PackageVersion Include="ILCompiler.Reflection.ReadyToRun.Experimental" Version="9.0.1-rtm.24557.9" />
<PackageVersion Include="Iced" Version="1.21.0" />
<PackageVersion Include="JunitXml.TestLogger" Version="5.0.0" />
Expand Down Expand Up @@ -39,6 +38,7 @@
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageVersion Include="NuGet.Protocol" Version="6.12.1" />
<PackageVersion Include="PowerShellStandard.Library" Version="5.1.1" />
<PackageVersion Include="Shouldly" Version="4.2.1" />
<PackageVersion Include="System.Composition.AttributedModel" Version="9.0.1" />
<PackageVersion Include="System.Collections.Immutable" Version="9.0.1" />
<PackageVersion Include="System.Memory" Version="4.6.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Shouldly" />
<PackageReference Include="JunitXml.TestLogger" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="System.Memory" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Shouldly" />
<PackageReference Include="JunitXml.TestLogger" />
<PackageReference Include="coverlet.collector">
<PrivateAssets>all</PrivateAssets>
Expand Down
44 changes: 23 additions & 21 deletions ILSpy.Tests/CommandLineArgumentsTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

using FluentAssertions;
using Shouldly;

using ICSharpCode.ILSpy.AppEnv;

Expand All @@ -16,88 +16,89 @@ public void VerifyEmptyArgumentsArray()
{
var cmdLineArgs = CommandLineArguments.Create(new string[] { });

cmdLineArgs.AssembliesToLoad.Should().BeEmpty();
cmdLineArgs.SingleInstance.Should().BeNull();
cmdLineArgs.NavigateTo.Should().BeNull();
cmdLineArgs.Search.Should().BeNull();
cmdLineArgs.Language.Should().BeNull();
cmdLineArgs.NoActivate.Should().BeFalse();
cmdLineArgs.ConfigFile.Should().BeNull();
cmdLineArgs.AssembliesToLoad.ShouldBeEmpty();
cmdLineArgs.SingleInstance.ShouldBeNull();
cmdLineArgs.NavigateTo.ShouldBeNull();
cmdLineArgs.Search.ShouldBeNull();
cmdLineArgs.Language.ShouldBeNull();
cmdLineArgs.NoActivate.ShouldBeFalse();
cmdLineArgs.ConfigFile.ShouldBeNull();
}

[Test]
public void VerifyHelpOption()
{
var cmdLineArgs = CommandLineArguments.Create(new string[] { "--help" });
cmdLineArgs.ArgumentsParser.IsShowingInformation.Should().BeTrue();
cmdLineArgs.ArgumentsParser.IsShowingInformation.ShouldBeTrue();
}

[Test]
public void VerifyForceNewInstanceOption()
{
var cmdLineArgs = CommandLineArguments.Create(new string[] { "--newinstance" });
cmdLineArgs.SingleInstance.Should().BeFalse();
cmdLineArgs.SingleInstance.ShouldNotBeNull();
cmdLineArgs.SingleInstance.Value.ShouldBeFalse();
}

[Test]
public void VerifyNavigateToOption()
{
const string navigateTo = "MyNamespace.MyClass";
var cmdLineArgs = CommandLineArguments.Create(new string[] { "--navigateto", navigateTo });
cmdLineArgs.NavigateTo.Should().BeEquivalentTo(navigateTo);
cmdLineArgs.NavigateTo.ShouldBe(navigateTo);
}

[Test]
public void VerifyNavigateToOption_NoneTest_Matching_VSAddin()
{
var cmdLineArgs = CommandLineArguments.Create(new string[] { "--navigateto:none" });
cmdLineArgs.NavigateTo.Should().BeEquivalentTo("none");
cmdLineArgs.NavigateTo.ShouldBe("none");
}

[Test]
public void VerifyCaseSensitivityOfOptionsDoesntThrow()
{
var cmdLineArgs = CommandLineArguments.Create(new string[] { "--navigateTo:none" });

cmdLineArgs.ArgumentsParser.RemainingArguments.Should().HaveCount(1);
cmdLineArgs.ArgumentsParser.RemainingArguments.Count.ShouldBe(1);
}

[Test]
public void VerifySearchOption()
{
const string searchWord = "TestContainers";
var cmdLineArgs = CommandLineArguments.Create(new string[] { "--search", searchWord });
cmdLineArgs.Search.Should().BeEquivalentTo(searchWord);
cmdLineArgs.Search.ShouldBe(searchWord);
}

[Test]
public void VerifyLanguageOption()
{
const string language = "csharp";
var cmdLineArgs = CommandLineArguments.Create(new string[] { "--language", language });
cmdLineArgs.Language.Should().BeEquivalentTo(language);
cmdLineArgs.Language.ShouldBe(language);
}

[Test]
public void VerifyConfigOption()
{
const string configFile = "myilspyoptions.xml";
var cmdLineArgs = CommandLineArguments.Create(new string[] { "--config", configFile });
cmdLineArgs.ConfigFile.Should().BeEquivalentTo(configFile);
cmdLineArgs.ConfigFile.ShouldBe(configFile);
}

[Test]
public void VerifyNoActivateOption()
{
var cmdLineArgs = CommandLineArguments.Create(new string[] { "--noactivate" });
cmdLineArgs.NoActivate.Should().BeTrue();
cmdLineArgs.NoActivate.ShouldBeTrue();
}

[Test]
public void MultipleAssembliesAsArguments()
{
var cmdLineArgs = CommandLineArguments.Create(new string[] { "assembly1", "assembly2", "assembly3" });
cmdLineArgs.AssembliesToLoad.Should().HaveCount(3);
cmdLineArgs.AssembliesToLoad.Count.ShouldBe(3);
}

[Test]
Expand All @@ -117,9 +118,10 @@ public void PassAtFileArguments()
{
}

cmdLineArgs.SingleInstance.Should().BeFalse();
cmdLineArgs.NoActivate.Should().BeTrue();
cmdLineArgs.AssembliesToLoad.Should().HaveCount(3);
cmdLineArgs.SingleInstance.ShouldNotBeNull();
cmdLineArgs.SingleInstance.Value.ShouldBeFalse();
cmdLineArgs.NoActivate.ShouldBeTrue();
cmdLineArgs.AssembliesToLoad.Count.ShouldBe(3);
}
}
}
2 changes: 1 addition & 1 deletion ILSpy.Tests/ILSpy.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Shouldly" />
<PackageReference Include="JunitXml.TestLogger" />
</ItemGroup>

Expand Down

0 comments on commit 15d8ed1

Please sign in to comment.