In this block we'll focus on testing (more precisely unit testing) and refactoring. In essance, unit testing is the art testing individual methods in isolation. Testing in a broader sense mostly refer to the art of verification. Remember to never hand in before all tests are passing. Be weary of false positives.
Please follow the below folder/file structure for the handin of this block.
B2.zip
Ex1
MathUtils
(VS solution)Ex2
Refactoring
(VS solution)Ex3
Matrix
(VS solution)Ex4
FizzBuzz
(VS solution)In this exercise we're going to familiarize ourselves with the concept of unit testing.
Class Library
project, and name it MathLibrary
.Unit Test Project
and name it MathLibraryTests
MathLibraryTests
project. Name it MathLibTests
.MathLibTests.cs
Solution Explorer
) to the MathLibrary
project in the MathLibraryTests
project. We do this because the test project is going to test classes in the MathLibrary
project, and thus need access to the classes.MathLib
contains a number of public static functions that perform math related operations. Not all methods are implemented. You must complete these implementations.
MathLibTests
contains a number of unit tests that aim to verify the functionality of all public methods in the MathLib
class. Not all tests are implemented. You must complete these implementations.
You decide whether you wish to write each test before each implementation or vice versa. Do not add or remove any methods. Make sure your handin contains both your implementation and your tests.
The purpose of this exercise is to practice the art of refactoring in controlled steps. Using tests to ensure correctnessa at each change. This exercise is designed by Martin Fowler, the author of the book Refactoring.
Note that one of the integration tests is commented out. This test corresponds to the expected output of the functionality (i.e. the HTML statement) that the above document suggests you should be able to implement quite easily after refactoring. Make sure that also that test is passing before handing in.
The purpose of this exercise is to use tests as a means of locating and fixing bugs. Matrix multiplication is not trivial. The person who built the class below thus failed. Your job is to use tests to locate and fix all bugs.
The purpose of this exercise is to explore the concept of letting tests drive implementation design. Your task is to implement a solution to the classic FizzBuzz problem. You are expected to employ test driven development and thus let your tests guide your implementation design.
The specification for the FizzBuzz problem is as follows.
"1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz"
Make sure your handin contains both your implementation and your tests.