forked from fluentassertions/fluentassertions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve caller identification for Visual Basic
In Visual Basic parentheses can be omitted if no arguments are provided. https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/sub-statement?redirectedfrom=MSDN#calling-a-sub-procedure
- Loading branch information
Showing
7 changed files
with
136 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<LangVersion>6.0</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="FSharpSpecs.fs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" /> | ||
<PackageReference Include="xunit" Version="2.5.0" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Src\FluentAssertions\FluentAssertions.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace FSharp.Specs | ||
|
||
open System | ||
open FluentAssertions | ||
open Xunit | ||
open Xunit.Sdk | ||
|
||
module FSharpSpecs = | ||
|
||
[<Fact>] | ||
let ``Caller identification works in F#`` () = | ||
// Arrange | ||
let subject = false | ||
|
||
// Act | ||
let act = Action(fun () -> subject.Should().BeTrue("") |> ignore) | ||
|
||
// Assert | ||
act.Should().Throw<XunitException>("").WithMessage("Expected subject to be true, but found false.", "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" /> | ||
<PackageReference Include="xunit" Version="2.5.0" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Src\FluentAssertions\FluentAssertions.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Imports FluentAssertions | ||
Imports FluentAssertions.Execution | ||
Imports FluentAssertions.Primitives | ||
Imports Xunit | ||
Imports Xunit.Sdk | ||
|
||
Namespace VB.Specs | ||
Public Class VBSpecs | ||
<Fact> | ||
Public Sub Caller_identification_works_with_parentheses() | ||
' Arrange | ||
Dim subject = False | ||
|
||
' Act | ||
Dim act As Action = Sub() subject.Should().BeTrue() | ||
|
||
' Assert | ||
act.Should().Throw(Of XunitException).WithMessage("Expected subject to be true, but found false.") | ||
End Sub | ||
|
||
<Fact> | ||
Public Sub Caller_identification_works_without_parentheses() | ||
' Arrange | ||
Dim subject = False | ||
|
||
' Act | ||
Dim act As Action = Sub() subject.Should.BeTrue() | ||
|
||
' Assert | ||
act.Should().Throw(Of XunitException).WithMessage("Expected subject to be true, but found false.") | ||
End Sub | ||
End Class | ||
End Namespace | ||
|