Extend BooleanAssertions with Implies
See original GitHub issueDescription
Add logical implication to the available boolean assertions.
That is, a.Should().Imply(b)
asserts that a → b
.
This would be useful in asserting, for example, that object equality implies hash-code equality without additional logic and a better built-in “because”.
Complete minimal example
Looking for something like this.
[DataTestMethod]
[DataRow(false, false)]
[DataRow(false, true)]
// failure case: [DataRow(true, false)]
[DataRow(true, true)]
public void A_Implies_B(bool a, bool b) => a.Should().Imply(b);
Note this is logically equivalent to !a || b
.
Additional Information
Also volunteering to add this.
Issue Analytics
- State:
- Created a year ago
- Comments:21 (21 by maintainers)
Top Results From Across the Web
What is the purpose of "extends boolean" in Typescript?
declare function f<T extends boolean>(x: T): T extends true ? string : number; // Type is 'string | number' let x = f(Math.random()...
Read more >Booleans
A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit...
Read more >Assertions (JUnit 5.0.1 API)
Asserts that the boolean condition supplied by booleanSupplier is not true . static void, assertFalse(boolean condition, Supplier<String> messageSupplier).
Read more >Assertions (AssertJ fluent assertions 3.18.1 API) - javadoc.io
Modifier and Type Method Description
static Condition allOf(Iterable> conditions) Creates a new AllOf
static Condition allOf(Condition... conditions) Creates a new AllOf
static Condition anyOf(Iterable> conditions) Creates...
Read more >Junit Assert & AssertEquals with Example
Assert which extends java.lang.Object class. There are various types of assertions like Boolean, Null, Identical etc.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is where my lack of CS degree shows 😉
Ah, I see now. So yes, I agree with @jnyrup