Skip to content

Helpful extensions for XUnit when working with LanguageExt

License

Notifications You must be signed in to change notification settings

colethecoder/ExtUnit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build status

ExtUnit

A tiny library that provides some helpful extensions when using XUnit with LanguageExt.

Installation

ExtUnit is available on Nuget. To setup a new test project you should install xunit.core, languageext.core and extunit.

PM> Install-Package xunit.core
PM> Install-Package languageext.core
PM> Install-Package extunit

Note: ExtUnit extends xunit.asserts so you need to use xunit.core and not the main xunit package (which would include xunit.asserts).

Example

Without ExtUnit if you wanted to use an Option<string> in an Assert you might do:

var op = Optional("test"); // Create Option<string> in Some state

op.Match(
    Some: x => Assert.Equal("test", x),
    None: () => Assert.Fail("Should never get here!")
);

With ExtUnit you can simply do:

var op = Optional("test"); // Create Option<string> in Some state

Assert.Some("test", op);

About

Helpful extensions for XUnit when working with LanguageExt

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages