Questions tagged [fsunit]

FsUnit is a set of libraries that makes unit-testing with F# more enjoyable. It adds a special syntax to your favorite .NET testing framework.

FsUnit is a set of libraries that makes unit-testing with F# more enjoyable. It adds a special syntax to your favorite .NET testing framework. FsUnit currently supports NUnit, MbUnit, xUnit, and MsTest (VS11 only).

The goals of FsUnit are:

  • to make unit-testing feel more at home in F# , i.e., more functional.
  • to leverage existing test frameworks while at the same time adapting them to the F# language in new ways.
58 questions
2
votes
2 answers

When making a test class with FsUnit, [] is not a valid attribute on a member. Why?

I'm fiddling with a new F# project (of which I haven't made many), and I'm aiming to do it in a TDD fashion. So, I'm trying to familiarize myself with using FsUnit, since I have a lot of experience using NUnit in C# projects, and it seems a pretty…
McMuttons
  • 871
  • 7
  • 22
2
votes
1 answer

Using `should equal` with sequences in F# and FsUnit

I am using FsUnit.Xunit. I am getting a failure for the following test case: [] let ``Initialization of DFF`` () = dff Seq.empty Seq.empty |> should equal (seq {Zero}) The test failure is: Message:  FsUnit.Xunit+MatchException :…
bmitc
  • 357
  • 1
  • 9
2
votes
1 answer

FsUnit showing two identical expected values for F# types

The two tests below fail, of course. But why do the error messages show two identical expected values? Is there a way of only showing one? myTest returns Expected: or But was: myTest2 returns Expected: <{ N = 2 }> or <{ N = 2 }> But…
Mark Pattison
  • 2,964
  • 1
  • 22
  • 42
2
votes
0 answers

Fsunit returns runtime generated actual value

We are using F# for our HTTP calls automation tests and I stumbled upon one runtime error from FsUnit that I am not sure I understand, I admit I wrote F# only 2 times in my life therefore this might be stupid question but bear with me. This is the…
kuskmen
  • 3,648
  • 4
  • 27
  • 54
2
votes
1 answer

Object expressions and error FS0419: 'base' values may only be used to make direct calls to the base implementations of overridden members

The error in the title is vague but googling it gives presently two hits on SO and five altogether (suggesting it is a rare beast, so don't expect too many visits here ;). I expect this question to be sixth in that list :p. Kvb's answer in this…
Abel
  • 56,041
  • 24
  • 146
  • 247
2
votes
1 answer

FsUnit won't match exception - F#

I am trying to assert an exception using FsUnit built upon XUnit. I have taken this test from the FsUnit website: [] let ``boom`` () = (fun () -> failwith "BOOM!" |> ignore) |> should throw typeof I am using Resharper…
Kevin Holditch
  • 5,165
  • 3
  • 19
  • 35
2
votes
3 answers

Visual Studio FsUnit test setup - Exception NUnit.Engine.NUnitEngineException

I am using Visual Studio 2013, installed FsUnit 2.2.0, which requires NUnit 3.2.1 and FSharpCore 3.1. I created a separate test project and put a testfixture and test in there. My platform is x64 Win 10. The config is for 'AnyCPU' and 'Debug'. I've…
user1857742
  • 151
  • 2
  • 10
2
votes
1 answer

How do I discover and run fsunit.xunit tests in F# in Visual Studio?

I am new to unit testing, but I want to experiment with xunit in F# (in a fresh VS2015 install). I created a new library, ran: Install-Package fsunit.xunit ... and I can create a test: [] let test () = "Yay" , but when I right-click and do…
Overlord Zurg
  • 3,430
  • 2
  • 22
  • 27
2
votes
1 answer

Unable to run TestCaseSource tests when the type under test overrides ToString

First, let me present the test setup in F# (using FsUnit on top of NUnit): type SimpleRecord = { A: int; B: int } override x.ToString() = x.A.ToString() [] type ``Simple Test Cases``() = static member…
Ifligus
  • 158
  • 3
  • 10
2
votes
1 answer

F# module member uninitialized

I'm writing unit tests in F# using FsUnit and NUnit, with the NUnit test adapter for VS2015 Ultimate CTP. I've come across an odd issue with a module member being null, where I wouldn't expect it to be. Is this an issue with the the code, or the way…
Andy Hunt
  • 1,053
  • 1
  • 11
  • 26
2
votes
1 answer

How do I setup FsUnit with Mono on Linux?

Without Visual Studio, I can't use NuGet. How can I setup a project to use FsUnit manually?
brabec
  • 4,632
  • 8
  • 37
  • 63
1
vote
1 answer

FSharp FsUnit No test is available in Make sure that test discoverer & executors are registered and platform & framework

OK so a google search reveals 100s if not thousands of links but they are very old threads talking about NUnit and Nuget. I am not using these these tools. I am writing a F# project with FsUnit and dotnet command line (no visual studio business). I…
Knows Not Much
  • 30,395
  • 60
  • 197
  • 373
1
vote
1 answer

How do I test "should not contain" using FsUnit.Xunit?

I am trying to test that a collection does not contain a value using FsUnit.Xunit. open FsUnit.Xunit [] let ``simple test`` () = let xs = [ 1; 2; 3 ] xs |> should contain 1 xs |> should not contain 99 // Not real code I have also…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
1
vote
1 answer

MathNet Numerics needs FsUnit.CustomMatchers to successfully build. Ran out of options

In trying to build the latest version of MathNet Numerics from GitHub using Visual Studio Community 15 with MathNet.Numerics.sln which needs DLLs for unit testing installed. Could not resolve this reference. Could not locate the assembly…
Guy Coder
  • 24,501
  • 8
  • 71
  • 136
1
vote
2 answers

Scoping & Indentation in fsunit

I can't seem to get the indentation right in my fsunit tests. I keep getting told to use the ML-style "use let ... in", but doing that means the compiler has trouble reading the name of the next test. Any suggestions ? [] module…
mwjackson
  • 5,403
  • 10
  • 53
  • 58