martaver / shouldbe Goto Github PK
View Code? Open in Web Editor NEWBeautiful object graph assertions for C#.
Beautiful object graph assertions for C#.
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.
Please, consider to add license (e.g.MIT) to your project and nuget package.
In other case it is complicated to use it in production app from legal point of view.
https://help.github.com/en/articles/licensing-a-repository
Given:
public IEnumerable<int> GetInts()
{
yield return 1;
yield return 2;
yield return 3;
}
and the test:
GetInts().ShouldLookLike(new [] { 1, 2, 3, 4 });
The test should throw an exception, but doesn't.
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.