Skip to content

Commit

Permalink
Merge pull request #226 from CaptnCodr/feature/NewYear
Browse files Browse the repository at this point in the history
New year's updates
  • Loading branch information
CaptnCodr authored Jan 13, 2023
2 parents c9459a6 + d3a6a5e commit e821351
Show file tree
Hide file tree
Showing 24 changed files with 104 additions and 63 deletions.
6 changes: 3 additions & 3 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"paket": {
"version": "7.1.5",
"version": "7.2.0",
"commands": [
"paket"
]
Expand All @@ -15,13 +15,13 @@
]
},
"fsdocs-tool": {
"version": "16.1.1",
"version": "17.2.0",
"commands": [
"fsdocs"
]
},
"fantomas": {
"version": "5.0.6",
"version": "5.1.5",
"commands": [
"fantomas"
]
Expand Down
4 changes: 2 additions & 2 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source https://api.nuget.org/v3/index.json
framework: net6.0, netstandard2.0
framework: net6.0, net7.0, netstandard2.0

nuget FSharp.Core ~> 5.0.0
nuget FSharp.Core ~> 6.0.0

nuget Microsoft.NET.Test.Sdk

Expand Down
74 changes: 36 additions & 38 deletions paket.lock
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
RESTRICTION: || (== net6.0) (== netstandard2.0)
RESTRICTION: || (== net6.0) (== net7.0) (== netstandard2.0)
NUGET
remote: https://api.nuget.org/v3/index.json
FSharp.Core (5.0.2)
Microsoft.CodeCoverage (17.3.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net45)) (&& (== netstandard2.0) (>= netcoreapp1.0))
Microsoft.NET.Test.Sdk (17.3.2)
Microsoft.CodeCoverage (>= 17.3.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net45)) (&& (== netstandard2.0) (>= netcoreapp1.0))
Microsoft.TestPlatform.TestHost (>= 17.3.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
Microsoft.NETCore.Platforms (6.0.6)
FSharp.Core (6.0.7)
Microsoft.CodeCoverage (17.4.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.NET.Test.Sdk (17.4.1)
Microsoft.CodeCoverage (>= 17.4.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.TestHost (>= 17.4.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.NETCore.Platforms (7.0)
Microsoft.NETCore.Targets (5.0)
Microsoft.TestPlatform.ObjectModel (17.3.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
Microsoft.TestPlatform.ObjectModel (17.4.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
NuGet.Frameworks (>= 5.11)
System.Reflection.Metadata (>= 1.6)
Microsoft.TestPlatform.TestHost (17.3.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
Microsoft.TestPlatform.ObjectModel (>= 17.3.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= uap10.0))
Newtonsoft.Json (>= 9.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= uap10.0))
Microsoft.TestPlatform.TestHost (17.4.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.ObjectModel (>= 17.4.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Newtonsoft.Json (>= 13.0.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
MSTest.TestAdapter (2.1.2)
NETStandard.Library (>= 1.6.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
System.Diagnostics.TextWriterTraceListener (>= 4.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
MSTest.TestFramework (2.2.10)
NETStandard.Library (>= 1.6.1) - restriction: || (&& (== net6.0) (< net5.0)) (== netstandard2.0)
System.Diagnostics.TextWriterTraceListener (>= 4.3) - restriction: || (&& (== net6.0) (< net5.0)) (== netstandard2.0)
NETStandard.Library (>= 1.6.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
System.Diagnostics.TextWriterTraceListener (>= 4.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
MSTest.TestFramework (3.0.2)
NETStandard.Library (2.0.3)
Microsoft.NETCore.Platforms (>= 1.1)
Newtonsoft.Json (13.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
NHamcrest (3.0.1)
NuGet.Frameworks (6.3.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= netcoreapp2.1))
Newtonsoft.Json (13.0.2) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
NHamcrest (3.1)
NuGet.Frameworks (6.4) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
NUnit (3.13.3)
NETStandard.Library (>= 2.0)
NUnit3TestAdapter (4.2.1)
runtime.native.System (4.3.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
NUnit3TestAdapter (4.3.1)
runtime.native.System (4.3.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
Microsoft.NETCore.Platforms (>= 1.1.1)
Microsoft.NETCore.Targets (>= 1.1.3)
System.Buffers (4.5.1) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0)
System.Collections (4.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
System.Buffers (4.5.1) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net7.0) (>= monotouch)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0) (>= xamarinios)) (&& (== net7.0) (< net6.0) (>= xamarinmac)) (&& (== net7.0) (< net6.0) (>= xamarintvos)) (&& (== net7.0) (< net6.0) (>= xamarinwatchos)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (== netstandard2.0)
System.Collections (4.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
System.Runtime (>= 4.3)
System.Collections.Immutable (6.0)
System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
System.Collections.Immutable (7.0)
System.Memory (>= 4.5.5) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0)
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (== net6.0) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0)
System.Collections.NonGeneric (4.3)
System.Diagnostics.Debug (>= 4.3)
System.Globalization (>= 4.3)
Expand All @@ -50,14 +48,14 @@ NUGET
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
System.Runtime (>= 4.3)
System.Diagnostics.TextWriterTraceListener (4.3)
System.Diagnostics.TextWriterTraceListener (4.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
System.Diagnostics.TraceSource (>= 4.3)
System.Globalization (>= 4.3)
System.IO (>= 4.3)
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.Threading (>= 4.3)
System.Diagnostics.TraceSource (4.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
System.Diagnostics.TraceSource (4.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
Microsoft.NETCore.Platforms (>= 1.1)
runtime.native.System (>= 4.3)
System.Collections (>= 4.3)
Expand All @@ -77,19 +75,19 @@ NUGET
System.Runtime (>= 4.3)
System.Text.Encoding (>= 4.3)
System.Threading.Tasks (>= 4.3)
System.Memory (4.5.5) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0)
System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (== netstandard2.0)
System.Numerics.Vectors (>= 4.4) - restriction: || (&& (== net6.0) (< netcoreapp2.0)) (== netstandard2.0)
System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= uap10.1)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (== netstandard2.0)
System.Numerics.Vectors (4.5) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0)
System.Memory (4.5.5) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0)
System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (&& (== net7.0) (>= monotouch)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= xamarinios)) (&& (== net7.0) (>= xamarinmac)) (&& (== net7.0) (>= xamarintvos)) (&& (== net7.0) (>= xamarinwatchos)) (== netstandard2.0)
System.Numerics.Vectors (>= 4.4) - restriction: || (&& (== net6.0) (< netcoreapp2.0)) (&& (== net7.0) (< netcoreapp2.0)) (== netstandard2.0)
System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= uap10.1)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (&& (== net7.0) (>= monotouch)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (< netcoreapp2.1)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= uap10.1)) (&& (== net7.0) (>= xamarinios)) (&& (== net7.0) (>= xamarinmac)) (&& (== net7.0) (>= xamarintvos)) (&& (== net7.0) (>= xamarinwatchos)) (== netstandard2.0)
System.Numerics.Vectors (4.5) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< netcoreapp2.0)) (== netstandard2.0)
System.Reflection (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
System.IO (>= 4.3)
System.Reflection.Primitives (>= 4.3)
System.Runtime (>= 4.3)
System.Reflection.Metadata (6.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= netcoreapp2.1))
System.Collections.Immutable (>= 6.0)
System.Reflection.Metadata (7.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
System.Collections.Immutable (>= 7.0)
System.Reflection.Primitives (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
Expand All @@ -103,12 +101,12 @@ NUGET
System.Runtime (4.3.1)
Microsoft.NETCore.Platforms (>= 1.1.1)
Microsoft.NETCore.Targets (>= 1.1.3)
System.Runtime.CompilerServices.Unsafe (6.0)
System.Runtime.CompilerServices.Unsafe (6.0) - restriction: || (== net6.0) (&& (== net7.0) (>= monotouch)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (< netcoreapp2.1)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= uap10.1)) (== netstandard2.0)
System.Runtime.Extensions (4.3.1)
Microsoft.NETCore.Platforms (>= 1.1.1)
Microsoft.NETCore.Targets (>= 1.1.3)
System.Runtime (>= 4.3.1)
System.Text.Encoding (4.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
System.Text.Encoding (4.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
System.Runtime (>= 4.3)
Expand All @@ -124,7 +122,7 @@ NUGET
xunit.assert (>= 2.4.2)
xunit.core (2.4.2)
xunit.abstractions (2.0.3)
xunit.analyzers (1.0)
xunit.analyzers (1.1)
xunit.assert (2.4.2)
NETStandard.Library (>= 1.6.1)
xunit.core (2.4.2)
Expand Down
2 changes: 1 addition & 1 deletion src/FsUnit.MsTestUnit/FsUnit.MsTest.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;netstandard2.0</TargetFrameworks>
<AssemblyName>FsUnit.MsTest</AssemblyName>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/FsUnit.MsTestUnit/FsUnit.fs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module FsUnit.MsTest

open System
open Microsoft.VisualStudio.TestTools.UnitTesting
open NHamcrest
open NHamcrest.Core
open Microsoft.VisualStudio.TestTools.UnitTesting

let inline private assertThat(actual, matcher: IMatcher<'a>) =
if not(matcher.Matches(actual)) then
Expand Down Expand Up @@ -34,6 +34,7 @@ let inline should (f: 'a -> ^b) x (actual: obj) =
let actual =
match actual with
| :? (unit -> unit) as assertFunc -> box assertFunc
| :? (unit -> obj) as assertFunc -> box(assertFunc >> ignore)
| _ -> actual

if isNull(box matcher) then
Expand Down
3 changes: 2 additions & 1 deletion src/FsUnit.MsTestUnit/paket.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ licenseUrl
requireLicenseAcceptance
false
copyright
Copyright 2012-2022
Copyright 2012-2023
tags
F# fsharp MsTest FsUnit
summary
Expand All @@ -23,6 +23,7 @@ description
FsUnit is a set of extensions that add special testing syntax to MsTest.
files
../../bin/FsUnit.MsTest/net6.0/FsUnit.* ==> lib/net6.0
../../bin/FsUnit.MsTest/net7.0/FsUnit.* ==> lib/net7.0
../../bin/FsUnit.MsTest/netstandard2.0/FsUnit.* ==> lib/netstandard2.0
../../src/install.ps1 ==> tools

Expand Down
2 changes: 1 addition & 1 deletion src/FsUnit.MsTestUnit/sample.paket.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ licenseUrl
requireLicenseAcceptance
false
copyright
Copyright 2015-2022
Copyright 2015-2023
tags
F# fsharp MsTest FsUnit
summary
Expand Down
2 changes: 1 addition & 1 deletion src/FsUnit.NUnit/FsUnit.NUnit.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;netstandard2.0</TargetFrameworks>
<AssemblyName>FsUnit.NUnit</AssemblyName>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
3 changes: 2 additions & 1 deletion src/FsUnit.NUnit/paket.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ licenseUrl
requireLicenseAcceptance
false
copyright
Copyright 2012-2022
Copyright 2012-2023
tags
F# fsharp NUnit FsUnit
summary
Expand All @@ -23,6 +23,7 @@ description
FsUnit is a set of extensions that add special testing syntax to NUnit.
files
../../bin/FsUnit.NUnit/net6.0/FsUnit.* ==> lib/net6.0
../../bin/FsUnit.NUnit/net7.0/FsUnit.* ==> lib/net7.0
../../bin/FsUnit.NUnit/netstandard2.0/FsUnit.* ==> lib/netstandard2.0
../../src/install.ps1 ==> tools

Expand Down
2 changes: 1 addition & 1 deletion src/FsUnit.NUnit/sample.paket.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ licenseUrl
requireLicenseAcceptance
false
copyright
Copyright 2015-2022
Copyright 2015-2023
tags
F# fsharp NUnit FsUnit
summary
Expand Down
7 changes: 5 additions & 2 deletions src/FsUnit.Xunit/CustomMatchers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,16 @@ let not'(x: obj) =

let throw(t: Type) =
let matches(f: obj) =
match f with
| :? (unit -> unit) as testFunc ->
let wrap testFunc =
try
testFunc()
false
with ex ->
t.IsAssignableFrom(ex.GetType())

match f with
| :? (unit -> unit) as testFunc -> wrap testFunc
| :? (unit -> obj) as testFunc -> wrap(testFunc >> ignore)
| _ -> false

CustomMatcher<obj>(string t, Func<_, _> matches)
Expand Down
2 changes: 1 addition & 1 deletion src/FsUnit.Xunit/FsUnit.Xunit.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;netstandard2.0</TargetFrameworks>
<AssemblyName>FsUnit.Xunit</AssemblyName>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions src/FsUnit.Xunit/FsUnit.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ let inline should (f: 'a -> ^b) x (actual: obj) =
let actual =
match actual with
| :? (unit -> unit) as assertFunc -> box assertFunc
| :? (unit -> obj) as assertFunc -> box(assertFunc >> ignore)
| _ -> actual

if isNull(box matcher) then
Expand Down
3 changes: 2 additions & 1 deletion src/FsUnit.Xunit/paket.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ licenseUrl
requireLicenseAcceptance
false
copyright
Copyright 2012-2022
Copyright 2012-2023
tags
F# fsharp xUnit FsUnit
summary
Expand All @@ -23,6 +23,7 @@ description
FsUnit is a set of extensions that add special testing syntax to xUnit.
files
../../bin/FsUnit.Xunit/net6.0/FsUnit.* ==> lib/net6.0
../../bin/FsUnit.Xunit/net7.0/FsUnit.* ==> lib/net7.0
../../bin/FsUnit.Xunit/netstandard2.0/FsUnit.* ==> lib/netstandard2.0
../../src/install.ps1 ==> tools

Expand Down
2 changes: 1 addition & 1 deletion src/FsUnit.Xunit/sample.paket.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ licenseUrl
requireLicenseAcceptance
false
copyright
Copyright 2015-2022
Copyright 2015-2023
tags
F# fsharp xUnit FsUnit
summary
Expand Down
2 changes: 1 addition & 1 deletion tests/FsUnit.MsTest.Test/FsUnit.MsTest.Test.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
Expand Down
12 changes: 12 additions & 0 deletions tests/FsUnit.MsTest.Test/raiseTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ type ApplicationException(msg: string) =

[<TestClass>]
type ``raise tests``() =

[<TestMethod>]
member _.``should pass when exception of expected type is thrown``() =
(fun () -> raise TestException |> ignore)
|> should throw typeof<TestException>

[<TestMethod>]
member _.``should pass when exception of expected type is thrown without ignore``() =
(fun () -> raise TestException) |> should throw typeof<TestException>

[<TestMethod>]
member _.``should fail when exception is not thrown``() =
(fun () -> ()) |> should not' (throw typeof<Exception>)
Expand Down Expand Up @@ -74,3 +79,10 @@ type ``raise tests``() =

(fun () -> raise(ApplicationException msg) |> ignore)
|> should not' ((throwWithMessage msg) typeof<ArgumentException>)

[<TestMethod>]
member _.``should pass without ignore``() =
let msg = "BOOM!"

(fun () -> raise(ApplicationException msg))
|> should (throwWithMessage msg) typeof<ApplicationException>
4 changes: 4 additions & 0 deletions tests/FsUnit.MsTest.Test/shouldFailTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ type ``shouldFail tests``() =
member _.``test raising exception``() =
fun () -> raise(ArgumentException "help")
|> should (throwWithMessage "help") typeof<ArgumentException>

[<TestMethod>]
member _.``Null source should fail``() =
shouldFail(fun () -> Seq.empty |> Seq.append null |> ignore)
2 changes: 1 addition & 1 deletion tests/FsUnit.NUnit.Test/FsUnit.NUnit.Test.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
<ItemGroup>
Expand Down
8 changes: 6 additions & 2 deletions tests/FsUnit.NUnit.Test/raiseTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ type ApplicationException(msg: string) =
type ``raise tests``() =
[<Test>]
member _.``should pass when exception of expected type is thrown``() =
(fun () -> raise TestException |> ignore)
|> should throw typeof<TestException>
(fun () -> raise TestException) |> should throw typeof<TestException>

[<Test>]
member _.``should fail when exception is not thrown``() =
Expand Down Expand Up @@ -76,3 +75,8 @@ type ``raise tests``() =

(fun () -> raise(ApplicationException msg) |> ignore)
|> should not' ((throwWithMessage msg) typeof<ArgumentException>)

[<Test>]
member _.``should pass without ignore``() =
(fun () -> raise(ApplicationException "BOOM!"))
|> should (throwWithMessage "BOOM!") typeof<ApplicationException>
Loading

0 comments on commit e821351

Please sign in to comment.