From the course: ASP.NET Core: Test-Driven Development

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Complete test cases

Complete test cases - ASP.NET Core Tutorial

From the course: ASP.NET Core: Test-Driven Development

Start my 1-month free trial

Complete test cases

- [Instructor] Now we're ready to start work on our last requirement. A booking cannot be made over the capacity of the room. So let's start by adding some tests for that. We'll copy this test to the end here. Make sure we give it the fact attribute. We'll remove these primitives as it's no longer a theory. And, we'll give it the name of guests less than capacity. We expect it to be valid. We'll change our mock result to say the room has capacity of four. And our booking request to say we're going to be bringing one guest. Now, I happen to know the way our code is set up this is actually going to return that it's valid. So in order to get a failing test we're going to set the test expectation to be false. Just to prove to ourselves that the result is what we expect. Great. Now we can change our test to be correct. And run the test again. Awesome. Now we're ready to move on to the next test. We'll copy this test. And finally, we'll be testing that the booking isn't valid if the room is…

Contents