A way to define a collection in argument constraint
See original GitHub issueWould be nice a new argument matcher for a collection of values, that can be good if we are testing some method that process an argument list
Something like this IsInOrderFromColection
public interface IDep { Double(int n); }
var mock = A.Fake<IDep>();
A.CallTo(() => mock.Double(A<int>._)).Returns(0);
var numbers = new[] { 2, 4, 5 };
foreach (var n in numbers)
mock.Double(n);
A.CallTo(() =>
mock.Double(A<int>.That.IsInOrderFromColection(2, 4, 5) ))
.MustHaveHappened();
it should verify if the Double
method is called with 2, 4 and 5 in sequence,
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Creating a method with a Set collection argument that ...
For this I have created some method public static void process(Set<ConstraintViolation<RegisterFormDTO>> validates) { ... }.
Read more >Argument constraints
Argument constraints. When configuring and asserting calls in FakeItEasy, the arguments of the call can be constrained so that only calls to the...
Read more >Constraints on type parameters - C# Programming Guide
Constraints specify the capabilities and expectations of a type parameter. Declaring those constraints means you can use the operations and ...
Read more >Chapter 3. Declaring and validating method constraints
In the remainder of this chapter you will learn how to declare parameter and return value constraints and how to validate them using...
Read more >C# Generic Parameter Constraints
Enforcing constraints on specific type parameters allows you to increase the number of allowable operations and method calls.
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
@blairconrad sorry, my example was wrong, I fixed it.
current
needs to be reassigned with the result ofThen
in the loop body.@lucasteles, I understand your reticence to include a loop in your test, but it might not be hard to hide it within a method. Hmm. Lemme try something.
I’m back. I hacked this up:
It’s not perfect, but maybe makes things more palatable for you? I tried fully genericizing the method, but the compiler could not figure out the signature.