Git Product home page Git Product logo

fsunit's Introduction

FsUnit

Build Status NuGet Status

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, xUnit, and MsTest.

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.

Getting Involved

GitHub makes collaboration very easy. To get involved with FsUnit, simply follow the directions provided by GitHub to fork this repository, then implement lots of cool stuff, and finally send a pull request.

A few things to keep in mind:

  • Going forward, FsUnit will aim to support as much functionality as possible across all supported testing frameworks.

  • Development environments need to be setup to run tests for xUnit and NUnit. A product like ReSharper can make this easier.

  • Since the unit tests for FsUnit are written with FsUnit, failing tests are just as important as passing tests.

Build Instructions

  • Find and run either ./build.sh or build.cmd (depending on your platform).

Maintainer(s)

The default maintainer account for projects under "fsprojects" is @fsprojectsgit - F# Community Project Incubation Space (repo management)

fsunit's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fsunit's Issues

FsUnitTyped.shouldEqual flips `expected` and `actual`

With FsUnit, as seen in the documentation, a unit test is written:

actual |> should equal expectedValue

We can verify by looking at the source code of Nunit's EqualityConstraint that indeed equal should be given the expected value.


The documentation for FsUnitTyped is a little sparse, but it still seems to follow the pattern "actual on the left; expected on the right".

However, if we look at the source code of shouldEqual in FsUnitTyped, we can see that it is defined with expected as the first argument and actual as the second.

So actual |> shouldEqual expectedValue will (on failure) print out:

Expected: actual
Actual: expected

I'm not sure if the arguments are flipped for the other functions in FsUnitTyped or if this just affects shouldEqual. I haven't used any of the others.

NUnit 3.x support

Pretty please? Is there anything to do here beyond bumping the version?

(should contain) as argument to list.iter

using xunit

list2 |> Seq.iter (list1 |> (should contain) ) does not work

however list2 |> Seq.iter (fun x - > list1 |> should contain x) does

(list |> should contain) returns a function of type object -> unit so I do not understand why I get a match exception.

Add "isUnionCase" function

Based on this SO question, I think that adding function isUnionCase would be pretty useful for testing.

(Or similar functionality exposed in some nicer FsUnit-friendly way, like should (beCase <@ Foo @>))

FsUnit.NUnit doesn't work on MonoDevelop 3.0

Hi,

We have an F# code base in Visual Studio 2012 and would like to support MonoDevelop 3.0 as well. On Mono, the core is running fine but our test cases written in FsUnit/NUnit failed before running (therefore we couldn't verify its correctness). We used NuGet to manage packages both in Visual Studio and MonoDevelop.

Configuration: Mono 3.0.2/F# 3.0, MonoDevelop 3.0 on Mac OS X Lion

Here is a simple repro:

  1. Use the LightBulb example from the home page
  2. Retrieve FsUnit.NUnit 1.1.0.2 and NUnit 2.6.2 via NuGet
  3. Run unit tests by default test runner in MonoDevelop
  4. All the tests fail with the same exception:
System.MissingMethodException : Method not found: 'FsUnit.equal'.

  at FsUnit.should[String,EqualConstraint] (Microsoft.FSharp.Core.FSharpFunc`2 f, System.String x, System.Object y) [0x00000] in <filename unknown>:0 
  at FsUnitSupport.Given a LightBulb that has had its state set to false.when I convert it to a string it becomes "Off". () [0x0004b] in /path/to/Test.fs:36 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 

A similar attempt by downloading FsUnit.NUnit.dll and nunit.framework.dll directly from the master branch didn't succeed.
FYI, a simple test project with NUnit alone worked fine.

Thanks,

Simplify "should throw"

Currently, you have to use ignore to discard the result in the function and you need to get type using typeof:

(fun () -> failwith "BOOM!" |> ignore) |> should throw typeof<System.Exception>

I think it would be neat if you could write just:

(fun () -> failwith "BOOM!") |> should throw<System.Exception>

Upgrade to latest Xunit (1.9.1)

The FSunit nuget fetches the latest Xunit on install. FSunit breaks in fascinating ways (unable to load assembly) when the Xunit version is not correct.
I tried to do the upgrade myself and deliver this request as a pull req, but apparently Nuget and F# are not very good friends, and I had to throw in the towel...

Formatting of autogenerated sample

When FSUnit is added to a project via nuget, the sample .fs file is formatted in such a way that the compiler assumes verbose syntax. (For example if you add lines you need to add 'in' to the end of every line.) The sample should be created so that light syntax is assumed. This is just a matter of changing the tabbing/newlines slightly.

How can I test an empty list inside tuple?

the example as below. If I don't remove the type annotation, how can I make it success?

open NUnit.Framework
open FsUnit

let id (a: int * string list) = a

[<Test>]
let ``test id`` () =
    let a = (0, [])
    id a |> should equal a

Should have multiple target frameworks

If I create a new F# library project based on .NET Framework 4.7 and add the FsUnit 3.0.0 nuget package, I get a lot of additional nuget packages, supporting .net standard library 1.6.

My expectation would be that the FsUnit package targeted more than just .net standard 1.6, for instance .NET Framework 4.6 in addition. That way, I would only get FsUnit and not 40+ other packages as well.

Nunit 3.2 is releasing minor updates that FsUnit doesn't install with

Description

FsUnit is locked to exactly v3.2.0 of NUnit, but there has been a 3.2.1 release that seems to work fine with an app.config redirect - but you have to force NuGet to ignore dependencies to install it.

I think it would be preferable if FsUnit accepted v3.2.* so FsUnit doesn't have to keep step with the releases in NUnit.

Windows build fails on latest official .NET/F# combo

  1. Building c:\sources\FsUnit\src\FsUnit.Xunit\FsUnit.Xunit.fsproj failed with exitcode 1.
  2. FS0219: c:\sources\FsUnit\src\FsUnit.Xunit\unknown(1,1): The referenced or default base CLI library 'mscorlib' is binary-incompatible with the referenced F# core library 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\FSharp.Core\v4.0_4.3.1.0__b03f5f7f11d50a3a\FSharp.Core.dll'. Consider recompiling the library or making an explicit reference to a version of this library that matches the CLI version you are using.
  3. FS0229: c:\sources\FsUnit\src\FsUnit.Xunit\unknown(1,1): Error opening binary file 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\FSharp.Core\v4.0_4.3.1.0__b03f5f7f11d50a3a\FSharp.Core.dll': The referenced or default base CLI library 'mscorlib' is binary-incompatible with the referenced F# core library 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\FSharp.Core\v4.0_4.3.1.0__b03f5f7f11d50a3a\FSharp.Core.dll'. Consider recompiling the library or making an explicit reference to a version of this library that matches the CLI version you are using.

Cannot get FsUnit.Xunit working in VS 2012

  1. Create a new F# Library project
  2. From Package Manager Console, Install-Package FsUnit.xUnit
  3. Run Test(s) (using TestDriven.NET)

------ Test started: Assembly: Library1.dll ------

Test 'Library1.Tests.Given a LightBulb that has had its state set to true.when I convert it to a string it becomes "On".' failed:
System.IO.FileLoadException : Could not load file or assembly 'NHamcrest, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31c3ea0b6fcf8c4a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at Library1.Tests.Given a LightBulb that has had its state set to true.when I convert it to a string it becomes "On".()

Test 'Library1.Tests.Given a LightBulb that has had its state set to true.when I ask whether it is On it answers true.' failed:
System.IO.FileLoadException : Could not load file or assembly 'NHamcrest, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31c3ea0b6fcf8c4a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at Library1.Tests.Given a LightBulb that has had its state set to true.when I ask whether it is On it answers true.()

0 passed, 2 failed, 0 skipped, took 2.01 seconds (xUnit.net 1.9.1 build 1600).

Install failed in new F# Portable Library project

I created a new F# Portable Library project and tried to add FsUnit via NuGet. I got this message:

Could not install package 'FsUnit 1.3.0.1'. You are trying to install this package into a project that targets 'portable-net45+win', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Separate nuget package for the sample

Hi,

Is it possible to move the sample into a separate Nuget package? Or, alternatively, provide a Nuget package without the sample file?

I use FsUnit in many projects, and whilst the sample is useful for someone starting out with FsUnit it has become problematic for us as every time I add FsUnit to a new project or update existing projects I have to go through and delete the sample.

Thanks,

FsUnit.NUnit.dll wrong version in NuGet?

Just installed latest from NuGet, and even though the package path is 1.1.0.2 (packages\FsUnit.1.1.0.2\Lib\Net40) the dll itself (FsUnit.NUnit) is version 1.1.0.0 and it is dependent on NUnit Version=2.6.0.12051 and does not work with the latest NUnit 2.6.2

FsUnit cannot be run

Steps to reproduce:

install-package fsunit

module test.mod
open NUnit.Framework
open FsUnit
let [<Test>] smoke () = 1 |> should equal 1

Have ReSharper 7.1 installed. Rightclick test project, select 'Run Unit Tests':

System.MissingMethodException : Method not found: 'Void FsUnit.TopLevelOperators.should(Microsoft.FSharp.Core.FSharpFunc`2<!!0,!!1>, !!0, System.Object)'.
   at test.mod.smoke()

Further testing done: downgrading NUnit to v2.6.2 from installing version 2.6.3.

Structural equality fail

This trivial test won't pass:

    [<Test>]
    member this.``structural equality``() =
        let actualList: char list = []
        [(actualList, "")] |> should equal [([], "")]

It fails with the interesting error:

Expected: [([], "")],
but was [([], "")]

However, it works correctly in FSI:

> let actualList: char list = [];;
   val actualList : char list = []
> [(actualList, "")] = [([], "")];;
   val it : bool = true

Why doesn't haveLength work with Seq?

Why doesn't haveLength work with Seq?

Error is System.ArgumentException : Property Length was not found

Related information

macOS, FsUnit.Xunit 1.4.1

should equal None works differently between NUnit and XUnit versions of FsUnit

My parser tests all look like the following (I've defined the zero function locally so you can easily add it to your tests. This works fine in FsUnit.NUnit, but when I tried to move over to FsUnit.XUnit, I get a NullReferenceException. I would expect tests to work the same between the different flavors of FsUnit

    [<Test>] member test.
     ``non-null should not be None`` ()=
        let zero : 'input -> ('result * 'input) option = fun input -> None in 
        zero "something" |> should equal None

Cross platform support

Description

Is there any chance to support other platforms than net45?
It would be nice to be able to add FsUnit to PCL, Xamarin, etc. projects?
I'd gladly give you a hand, too.

Repro steps

Create a PCL/Xamarin.iOS/Xamarin.Android/.. project and try add FsUnit as a nuget package.

\n in an exception

Program:

open FsUnitTyped
open NUnit.Framework

1 |> shouldEqual 2
1 |> shouldNotEqual 2

Output:

NUnit.Framework.AssertionException:   Expected: 2\nActual: 1
  Expected: True
  But was:  False

What bothers me is that \n that is printed as a part of the actual string. This is my first time using both FsUnit and NUnit, but that can't be right.

You must add a reference to assembly 'nunit.framework'.

Description

I get this error:
The type referenced through 'NUnit.Framework.Constraints.Constraint' is defined in an assembly that is not referenced. You must add a reference to assembly 'nunit.framework'.

Repro steps

Installed as per the instructions.

Visual Studio 2017
FsUnit 3.0.0
nunit 3.6.0

    open NUnit.Framework
    open FsUnit
    1 |> should equal 1

this fails with the above error but

    Assert.AreEqual(1,1)

works fine.

Update FsUnit.xUnit Nuget package please

This relates to these issues:
#22

and
#10

I am still getting the null ref exception when attempting to do a |> should equal (None).

I believe the Nuget package FsUnit.xUnit is dependending on an old version of FsUnit.CustomMatchers.dll.

I verified by inspecting the assembly downloaded via nuget. The pre #22 code is still there.

   public static CustomMatcher<object> equal(object x)
    {
      return new CustomMatcher<object>(PrintfModule.PrintFormatToStringThen<FSharpFunc<string, string>>((PrintfFormat<FSharpFunc<string, string>, Unit, string, string>) new PrintfFormat<FSharpFunc<string, string>, Unit, string, string, string>("Equals %s")).Invoke(x.ToString()), new Func<object, bool>(new CustomMatchers.equal\u00408(x).Invoke));
    }

is there a better way to match against patterns?

Right now, I'm using a match ... with clause with the pattern I want (e.g. I don't care about all the items in a tuple) manually.

    match f() with
    | _, _, _, 42 -> true
    | _ -> false
    |> should equal true

which is very clumsy. Is there a better way to do this currently?

In Eunit, I'd use ?assertMatch which uses macros (which we don't have in F#), is there some way to achieve the same effect in F#?

should throw typeof<Exception> does not pass

This code does not pass:

[<TestFixture>] 
type ``Given a invalid connection string`` () =
    let connstr = @"lkjljlj"

    [<Test>] member x.
        ``An argument exception will be thrown.`` () = 
            connstr |> parseConnStrToRavenConn |> should throw typeof<System.ArgumentException>

Code throws a System.ArgumentException and, thus, should pass.

Statically typed equality test

In an earlier version, there used to be shouldEqual primitive that beahaved like y |> should equal x but statically required x and y to have the same type.

I find that extremely useful - I was using some untyped equal constraints and it quite regularly caused trouble where test would compile, but fail - when I changed some API.

Can we have this function (or some alternative) back?

3 MbUnit tests are failing

following 3 MbUnit tests are failing:

  1. Seq with 1 item should fail to have Count 1
  2. Seq with 1 item should fail to have Length 1
  3. shouldFaild should throw an exception

here is the complete execution log for failing tests:

FsUnit.MbUnit.Test 
Passed0Failed3Inconclusive or Skipped0
Duration: 0.393s, Assertions: 6.
File: D:\My\Projects\tmp\2\FsUnit-master\tests\FsUnit.MbUnit.Test\bin\Release\FsUnit.MbUnit.Test.DLL
CodeBase: D:\My\Projects\tmp\2\FsUnit-master\tests\FsUnit.MbUnit.Test\bin\Release\FsUnit.MbUnit.Test.DLL
Version: 0.0.0.0
Framework: MbUnit v3.4 build 11
have Count tests 
Passed0Failed1Inconclusive or Skipped0
Duration: 0.326s, Assertions: 2.
Seq with 1 item should fail to have Count 1 

Duration: 0.296s, Assertions: 2.
An exception occurred while verifying an assertion.

System.ArgumentException: Property Count was not found
Parameter name: name
ParamName: name
   at FsUnit.CustomMatchers.op_Dynamic[Source,Result](Source this, String name) in D:\My\Projects\tmp\2\FsUnit-master\src\FsUnit.Xunit\CustomMatchers.fs:line 118
   at [email protected](Object arg) in D:\My\Projects\tmp\2\FsUnit-master\src\FsUnit.Xunit\CustomMatchers.fs:line 123
   at NHamcrest.CustomMatcher`1.Matches(T item) in C:\Documents and Settings\Graham\My Documents\NHamcrest\NHamcrest\CustomMatcher.cs:line 28

   at <StartupCode$FsUnit-MbUnit-Test>.$HaveCountTests.Seq with 1 item should fail to have Count [email protected](Unit unitVar0) in D:\My\Projects\tmp\2\FsUnit-master\tests\FsUnit.MbUnit.Test\haveCountTests.fs:line 32
   at [email protected](Object arg) in D:\My\Projects\tmp\2\FsUnit-master\src\FsUnit.Xunit\CustomMatchers.fs:line 29
   at NHamcrest.CustomMatcher`1.Matches(T item) in C:\Documents and Settings\Graham\My Documents\NHamcrest\NHamcrest\CustomMatcher.cs:line 28
   at FsUnit.Test.have Count tests.Seq with 1 item should fail to have Count 1() in D:\My\Projects\tmp\2\FsUnit-master\tests\FsUnit.MbUnit.Test\haveCountTests.fs:line 32

Expected System.ArgumentException

Expected : System.ArgumentException
But      : was <StartupCode$FsUnit-MbUnit-Test>.$HaveCountTests+Seq with 1 item should fail to have Count 1@32

   at FsUnit.Test.have Count tests.Seq with 1 item should fail to have Count 1() in D:\My\Projects\tmp\2\FsUnit-master\tests\FsUnit.MbUnit.Test\haveCountTests.fs:line 32

haveLength tests 
Passed0Failed1Inconclusive or Skipped0
Duration: 0.011s, Assertions: 2.
Seq with 1 item should fail to have Length 1 

Duration: 0.007s, Assertions: 2.
An exception occurred while verifying an assertion.

System.ArgumentException: Property Length was not found
Parameter name: name
ParamName: name
   at FsUnit.CustomMatchers.op_Dynamic[Source,Result](Source this, String name) in D:\My\Projects\tmp\2\FsUnit-master\src\FsUnit.Xunit\CustomMatchers.fs:line 118
   at [email protected](Object arg) in D:\My\Projects\tmp\2\FsUnit-master\src\FsUnit.Xunit\CustomMatchers.fs:line 121
   at NHamcrest.CustomMatcher`1.Matches(T item) in C:\Documents and Settings\Graham\My Documents\NHamcrest\NHamcrest\CustomMatcher.cs:line 28

   at <StartupCode$FsUnit-MbUnit-Test>.$HaveLengthTests.Seq with 1 item should fail to have Length [email protected](Unit unitVar0) in D:\My\Projects\tmp\2\FsUnit-master\tests\FsUnit.MbUnit.Test\haveLengthTests.fs:line 45
   at [email protected](Object arg) in D:\My\Projects\tmp\2\FsUnit-master\src\FsUnit.Xunit\CustomMatchers.fs:line 29
   at NHamcrest.CustomMatcher`1.Matches(T item) in C:\Documents and Settings\Graham\My Documents\NHamcrest\NHamcrest\CustomMatcher.cs:line 28
   at FsUnit.Test.haveLength tests.Seq with 1 item should fail to have Length 1() in D:\My\Projects\tmp\2\FsUnit-master\tests\FsUnit.MbUnit.Test\haveLengthTests.fs:line 45

Expected System.ArgumentException

Expected : System.ArgumentException
But      : was <StartupCode$FsUnit-MbUnit-Test>.$HaveLengthTests+Seq with 1 item should fail to have Length 1@45

   at FsUnit.Test.haveLength tests.Seq with 1 item should fail to have Length 1() in D:\My\Projects\tmp\2\FsUnit-master\tests\FsUnit.MbUnit.Test\haveLengthTests.fs:line 45

shouldFail tests 
Passed0Failed1Inconclusive or Skipped0
Duration: 0.011s, Assertions: 2.
shouldFaild should throw an exception 

Duration: 0.008s, Assertions: 2.
Expected True
Method should fail

Expected : True
But      : was False

   at <StartupCode$FsUnit-MbUnit-Test>.$ShouldFailTests.shouldFaild should throw an [email protected](Unit unitVar0) in D:\My\Projects\tmp\2\FsUnit-master\tests\FsUnit.MbUnit.Test\shouldFailTests.fs:line 23
   at [email protected](Object arg) in D:\My\Projects\tmp\2\FsUnit-master\src\FsUnit.Xunit\CustomMatchers.fs:line 29
   at NHamcrest.CustomMatcher`1.Matches(T item) in C:\Documents and Settings\Graham\My Documents\NHamcrest\NHamcrest\CustomMatcher.cs:line 28
   at FsUnit.Test.shouldFail tests.shouldFaild should throw an exception() in D:\My\Projects\tmp\2\FsUnit-master\tests\FsUnit.MbUnit.Test\shouldFailTests.fs:line 23

Expected System.Exception

Expected : System.Exception
But      : was <StartupCode$FsUnit-MbUnit-Test>.$ShouldFailTests+shouldFaild should throw an exception@23

   at FsUnit.Test.shouldFail tests.shouldFaild should throw an exception() in D:\My\Projects\tmp\2\FsUnit-master\tests\FsUnit.MbUnit.Test\shouldFailTests.fs:line 23

contain on strings does not work as expected

I expected

"This string is long" |> should contain "string"

to do something like a test framework's Assert.Contains<string,string>, and the error message I get was (at first) quite confusing:

Test Name:  Test contain raw
Test Outcome:   Failed
Test Duration:  0:00:00.081

Result Message: 
Exception of type 'FsUnit.Xunit+MatchException' was thrown.
Position: First difference is at position 0
Expected: Contains string
Actual:   was This string is long
Result StackTrace:  
at FsUnit.Xunit.Assert.That.Static[a](a actual, IMatcher`1 matcher)
  at TestTestFramework.Test contain raw() in <snip>TestTestFramework.fs:line 13

NuGet package lib/net40 contains .Net 2.0 binary

Currently there are separate assemblies in the FsUnit 1.3.0.1 NuGet package:

  • lib/net20: built against .Net 2.0, references FSharp.Core 2.3.0.0
  • lib/net40: built against .Net 2.0, references FSharp.Core 2.3.0.0

Would it be possible to keep the net20 as is but change the net40 one to build against .Net 4.0 and reference FSharp.Core 4.3.0.0?

I have a binding redirect issue in one of my projects where I need to redirect to FSharp.Core 2.3.0.0 for .Net 3.5 and to FSharp.Core 4.3.1.0 for all other platforms, but this does not work with FsUnit as it will always try to load the 2.3.0.0 one even in .Net 4.0 - which then conflicts with the other dependencies or fails to load entirely. In other words, since both reference exactly the same version, I cannot treat them separately for .Net 2.0 and .Net 4.0.

fsunit assembly is not signed with a strong name

In using fsunit from a strongly-named assembly I get the folllowing error

1) Test Error : TryFsunit.lib1.hello System.IO.FileLoadException : Could not load file or assembly 'FsUnit.NUnit, Version=1.3.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HR ESULT: 0x80131044) at TryFsunit.lib1.hello()

Nunit works fine. It's just FSunit that isn't signed. There are many ways to sign an assembly in the FSUnit build process -- see msdn article

To reproduce

  1. create a small library project. See (1)
  2. add fsunit from nuget to the project
  3. add any test
  4. sign that library with a strong name. (There are many ways to do that. I used the <OtherFlags>--keyfile:SomeSignature.snk</OtherFlags> method in the .fsproj). See (2)
  5. build with msbuild
  6. run from command line "nunit-console.exe"
  7. you will see the above error "Could not load file or assembly 'FsUnit.NUnit'...A strongly-named assembly is required."

(1) Sample library1.fs fragment

let add a b = a + b
// this fails at test runtime
[<Test>] 
let hello2() = add 2 3 |> should equal 5
// This works, which means: nunit is strong signed. But fsunit is not. 
[<Test>] 
let hello() =
    let n = add 2 3
    Assert.That(n,Is.EqualTo(5))

(2) Sample .fsproj file fragment with <OtherFlags>

<PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <OutputType>Library</OutputType>
  ....
  <OtherFlags>--keyfile:SignKeyLifeQuest.snk</OtherFlags>
</PropertyGroup>

FsUnit.xUnit 1.2.1.2 and FsCheck.Xunit 0.4.0.2 don't play together :-(

Thank you for the wonderful FsUnit.

I was hoping to use FsUnit and FsCheck together in joyous union of ultimate-test-nirvana-fun, but alas, they ๐Ÿ’• different versions of xUnit. FsUnit desiring exactly xunit (= 1.9.1) and FsCheck a little more open to xunit (โ‰ฅ 1.9.2 && < 3.0).

How can I help make these fine libraries play together?

Matching arrays does not work

The first assertion does what you would expect, but the second (array version) is considered a match failure. Using dmohl-FsUnit-dee815d.

open Xunit
open FsUnit.Xunit

[1] |> should equal [1]
// FAILS
[|1|] |> should equal [|1|]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.