Skip to content

Add collection constraints from NUnit #133

@CaptnCodr

Description

@CaptnCodr

Description

I just wrote some tests and wanted to test a collection that has the equivalent item than another.

Could you please implement the collection constraints from NUnit?

Repro steps

I have to use NUnit's function with like:
let areCollectionsEqual = CollectionAssert.AreEquivalent([1;2;3], [3;1;2])

It's not so "F#-ish".

Known workarounds

I "extended" FsUnit with an extra function:

module FsUnit = 
  open NUnit.Framework.Constraints

  let equalsToCollection x = CollectionEquivalentConstraint x

So I can use this function like:

let areCollectionsEqual () = [1;2;3] |> should equalsToCollection [3;1;2]

Collection contraints implemented:

  • equivalent
  • supersetOf
  • subsetOf

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions