From the course: Test-Driven Development in C++
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Add items, add item prices, and calculate the current total - C++ Tutorial
From the course: Test-Driven Development in C++
Add items, add item prices, and calculate the current total
- [Instructor] In this lecture I'll be implementing the add item prices and items, and calculate total test cases. I'm gonna begin my marking off the can instantiate checkout test case, let's do that now. Okay, then I need to create the test for the can add item price test case which will simply instantiate the checkout class and try to call in add item price method that will pass in the item string and the unit price as an integer. So I'll do that now. Test checkout test can add item price. Checkout co co dot add item price. The item name is A with a price of one. Okay, and so here I can see the ID is already telling me that I have a compiler error because the add item price method does not yet exist in a checkout class. And as our TDD rules state, compiling is equivalent to a failing unit test. Okay so now that I've got a failing unit test, I need to enter the green phase and make the test pass. I need to make it pass the simplest way possible. In this case I just need to implement…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Overview, setup, and the first test case6m 10s
-
(Locked)
Add items, add item prices, and calculate the current total9m 56s
-
(Locked)
Add multiple items and calculate the total3m 49s
-
(Locked)
Add and apply discounts19m 37s
-
(Locked)
Throw an exception when adding an item with no price3m 2s
-
(Locked)
-
-
-