Isolator for SharePoint which is an essential component for anyone doing unit testing in a SharePoint environment.
- In order to test the behaviour here, we have one of two choices, We can either use the extract and overide method, or we can use TypeMock to isolate the randomiser and replace it’s behaviour.
- The extract and overide method requires us to create a new FakeBall class in our test namespace, that inherits from our Ball class. We then adjust the Ball class to make it’s randomiser method to be protected virtual rather than private. This allows us to override it’s behaviour in our FakeBall class.
- In our FakeBall class, we want to pass it in a value that will be passed back to the Base ball object, thus choosing which index to return.