public void Setup() { // Setup is run before every test case. // We are going to test the DotaWebApi by injecting a // mock implementation of IWebClient. A mock is a class that implements // an interface in a dummy or trivial way, allowing us to test code that // depends on that interface. // // Moq is a mocking framework that create mock objects at runtime. // First we create mock instance of IWebClient. mockClient = new Mock<IWebClient>(); // Then we inject that into the class we want to test. api = new DotaWebApi(mockClient.Object); }
public void Setup() { mockClient = new Mock<IWebClient>(); api = new DotaWebApi(mockClient.Object); }
public Program() { var webClient = new WebClient(); var api = new DotaWebApi(webClient); poller = new MatchPoller(api); }