Beispiel #1
0
        //
        // GET: /WebAPI/

        public ActionResult MatchDetails(string matchId)
        {
            var api       = new DotaWebApi();
            var matchJson = api.GetMatchDetails(matchId);

            return(Content(matchJson, "application/json"));
        }
Beispiel #2
0
        public Program()
        {
            var webClient = new WebClient();
            var api       = new DotaWebApi(webClient);

            poller = new MatchPoller(api);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public void Setup()
 {
     mockClient = new Mock <IWebClient>();
     api        = new DotaWebApi(mockClient.Object);
 }