Skip to main content

Posts

Showing posts from June, 2020

Getting Started with FakeItEasy

I've been writing unit tests for a long time now and let me tell you - writing good unit tests are really hard, especially when the system under test (SUT) has several dependencies that have some complex logic in them.  Some characteristics of good unit tests are: 1. Atomicity - It has to test one thing. 2. Deterministic - It should either Pass/Fail 3. Repeatable - Should yield the same result no matter how many times it runs. 4. Order Independent - Must be able to run in an isolated fashion 5. Fast - Run within milliseconds (in most cases) 6. Easy to Setup In order to meet these criteria, it's important to address the issues with dependencies. This is where test doubles or mocking frameworks come into the picture.  What is FakeItEasy? A .Net dynamic fake framework for creating all types of fake objects, mocks, stubs etc. Mock objects allow you to mimic the behavior of classes and interfaces, letting