3
votes
Accepted
Integer index based Union Find with path compression strategy
Using two arrays of int
That's nice. There is a tendency to use Node objects that refer to each other by address, which still ...
3
votes
Simple HttpClient usage for integration tests in .NET Core
First of all I would like to say that, in my opinion, testing API in a such way is wrong, because how does such unit test behave when:
developer machine does not have Internet connection?
developer ...
2
votes
Unit tests for a function that calculates demerit points for speeding
You probably want to
add a constant for speed 0
create a test for MaxSpeed
create a test case for 64 (it's one edge of the partition class ...
2
votes
Accepted
Unit tests for a function that calculates demerit points for speeding
Am I using too many test cases for CalculateDemeritPoints_WhenCalled_ReturnsExpectedInt?
Yes. I'd say so, anyway.
Let's say I'm maintaining code you've written. ...
2
votes
TDD Supermarket Pricing Kata
I know this is a little old, but the Checkout kata is one of my favorites and I wanted to add my 2 cents.
Looking at the original submission and a couple previous answers, I think they are all a ...
2
votes
Testing Code That Has Time Delays
Make your code return a Task. Even if you don't await it in the program doesn't mean you can't await it in your test. Also pass in a TimeSpan instead of int for seconds.
...
1
vote
Unit Testing - test deletion of archived files
You should create the files in the test setup.
Creating and deleting files in the file system takes some time. Using some FS mock / fake will make the test run much faster.
1
vote
Unit tests for a function that calculates demerit points for speeding
Since this code is a black box, because it calculates everything itself without calling any dependencies the caller can be aware of, we should test this method with sufficient variations of input to ...
1
vote
Poker Game: Unit testing different poker hands without violating DRY principles
I decided to post a self-answer as suggested by t3chbot because the following code example is just an attempt at following Simon's suggestion; I haven't fully incorporated the code as I have not ...
1
vote
Poker Game: Unit testing different poker hands without violating DRY principles
IMO I'd join all of your tests into one. And just rotate through them.
...
1
vote
Accepted
Poker Game: Unit testing different poker hands without violating DRY principles
One thing that would help with reducing duplication is to use parameterized tests.
Additionally, you might want to have a enum with the different hand types instead of - or in addition to - having ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
nunit × 31c# × 28
unit-testing × 24
moq × 5
design-patterns × 3
beginner × 2
.net × 2
role-playing-game × 2
interview-questions × 1
comparative-review × 1
homework × 1
database × 1
event-handling × 1
f# × 1
vb.net × 1
rest × 1
selenium × 1
.net-core × 1
fluent-interface × 1
integration-testing × 1
google-chrome × 1
union-find × 1
ninject × 1
monogame × 1