question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Repeated class is misleading

See original GitHub issue

A verification of IReturnValueArgumentValidationConfiguration<T>.MustHaveHappened(Repeated.Exactly.Once) in the English language, this means that the call must have happened twice; once, then repeated exactly once. Recommend changing the name of this Repeated class to Executed or something so there’s no confusion.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:25 (21 by maintainers)

github_iconTop GitHub Comments

1reaction
blairconradcommented, Jan 28, 2018

MustHaveHappenedANumberOfTimesMatching(IsPrime) // where IsPrime is a method group

I’d drop this. It’s not supported now, and wouldn’t produce good failure messages anyhow. If a call to a helper predicate is needed, we should rely on

MustHaveHappenedANumberOfTimesMatching(n => IsPrime(n))
1reaction
blairconradcommented, Jan 22, 2018

@thomaslevesque and I went off and chatted about possible replacements for Repeated. Here’s an API we’re considering:

MustHaveHappened()    // as today
MustNotHaveHappened() // as today

MustHaveHappenedOnceExactly()
MustHaveHappenedTwiceExactly()
MustHaveHappened(3, Times.Exactly)
MustHaveHappened(3, Times.OrMore)
MustHaveHappened(3, Times.OrLess)

MustHaveHappenedANumberOfTimesMatching(n => n %2 == 0)
MustHaveHappenedANumberOfTimesMatching(IsPrime) // where `IsPrime` is a method group

Times would be a new static class.

We like this approach because

  1. MustHaveHappened() and MustNotHaveHappened() stay, and they should be by far the most popular of these kinds of methods in use today
  2. It eliminates (I think) the confusion over the exact semantics of Repeated
  3. It improves discoverability, even over the existing Repeated mechanism
  4. We don’t have to invert the natural order of words (e.g. Times(3)), nor add an extension method to int

And we can also supply a soft transition: the Repeated variants can live for a major release or two, likely deprecated in 5.0.0 and removed in 6.0.0. In the interim, the documentation can be updated to push users to the new format, either ignoring the old one or explicitly mentioning Repeated as a legacy approach.

Accordingly, I’m reopening the issue. Comments welcome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it wise to repeat a class if your results were bad?
No.. repeating a class isn't right. What grades you scored is your past you can change your school for better studies but you...
Read more >
5 Reasons You Should Retake Classes (& 6 ... - Get Smart Soon
A final reason why students may want to rethink retaking a course is if it will delay their graduation. If graduating in the...
Read more >
Fixing a misleading “duplicate class” error during ...
All of the apparently duplicate classes are temporary Java files (the codebase is 100% Kotlin) and the classes all only have 1 definition....
Read more >
Can I sue my university for making me repeat classes ...
Can I sue a high school counselor for stating false information about my credits that will affect my graduation? Jersey City, NJ |...
Read more >
Documenting Repeat Classes in DICAS
Repeat courses, in particular can be a little confusing because of the way the options are stated in DICAS, so let's talk about...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found