Git Product home page Git Product logo

shouldbe's People

Contributors

martaver avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

shouldbe's Issues

ShouldBe.GreaterThan cannot effectively assert that id is greater than 0

The test in the example: This line in ShouldBeAssertions.Tests.Samples.Samples.UsingShouldBeAssertions: Id = ShouldBe.GreaterThan(0).NameThis("OrderId").
Id is 2, Is greater than 0, it should pass the test, but the results reported that their values are different: Types [Int32,Int32], Item Left.Id != Right.Id, Values (2,167)
Its logic should be to judge whether Id is greater than 0, but in fact it compares Id with a random number greater than 0 for equality, which is logically wrong.

Value types with low variability aren't able to use value-based constraints

For every other value, such as int or a reference type, the uniquely generated placeholder value is used to look up a constraint definition. This works, because for reference types each placeholder value is truly unique and integers have enough variability that collisions from random number generation can be reasonably minimized.

For value types like bool and byte, however, this is not the case. In the case of bool, we only have two values available to us, true or false, so collisions are inevitable.

How can we get around this and allow bool values (and other low variability value types) to take advantage of ShouldBe constraints?

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.