Git Product home page Git Product logo

easyassertions's People

Contributors

soxtoby avatar tullo-x86 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

easyassertions's Issues

Enum assertions

ShouldHaveFlag for [Flags] enums.
Try adding ShouldBe for enums that gets R# autocompletion working.

ShouldMatch error message should handle nested IEnumerables

new [] { new [] { 1 } }.ShouldMatch(new[] { new [] { 2 } });

Fails with a message like "Array'1[Int32] should have been Array'1[Int32]", but it should be more like: "Item 0, 0 should have been 2, but was 1". Doesn't have to be perfect, but it should get across that it's the items that aren't matching, not the inner enumerables.

Disallow return values for ItemsSatisfy callbacks

To stop people from accidentally using comparison functions when they should be asserting, add ItemsSatisfy, AllItemsSatisfy etc. functions that take Funcs instead of Actions, and mark them as obsolete.

Prevent ShouldBeNull on non-nullable types

Replace single extension with two more constrained extensions:

public static void ShouldBeNull<TActual>(this TActual actual, string message = null) where TActual : class { }
public static void ShouldBeNull<TActual>(this TActual? actual, string message = null) where TActual : struct { }

Support new .NET types

Should support ValueTask & IAsyncEnumerable. Record types are probably fine, but better double-check.

Add ShouldNotComplete task assertion

As much as I hoped to avoid it, I keep needing to assert that a task doesn't complete after a certain period of time. If it has a default timeout, it should be much less than ShouldComplete's default of 1 second.

Allow asserting in equality funcs

Instead of

listA.ShouldMatch(listB, (a, b) => a.Prop == b.Prop));

you should be able to assert:

listA.ShouldMatch(listB, (a, b) => a.Prop.ShouldBe(b.Prop));

The error messages would be a lot more useful when you know which property didn't match.

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.