Пример #1
0
        public void GetUpcomingEventsReturnsListFromServer()
        {
            var mockHttpMessageHandler = new MockHttpMessageHandlerFactory();
            var eventService           = new EventsService(mockHttpMessageHandler);
            var events = eventService.GetUpcomingEvents().Result;

            Assert.IsNotEmpty(events.Data);
        }
Пример #2
0
        public void GetUpcomingEventsReturnsUnauthorizedFromServerOnUnauthorized()
        {
            var mockHttpMessageHandler = new MockHttpMessageHandlerFactory();

            mockHttpMessageHandler.MockApiHandler.ReturnUnauthorized = true;
            var eventService = new EventsService(mockHttpMessageHandler);
            var events       = eventService.GetUpcomingEvents().Result;

            Assert.AreEqual(System.Net.HttpStatusCode.Unauthorized, events.StatusCode);
        }
Пример #3
0
        public void GetUpcomingEventsReturnsStatusCodeFromServerOnNotOk()
        {
            var mockHttpMessageHandler = new MockHttpMessageHandlerFactory();

            mockHttpMessageHandler.MockApiHandler.ReturnInternalServerError = true;
            var eventService = new EventsService(mockHttpMessageHandler);
            var events       = eventService.GetUpcomingEvents().Result;

            Assert.AreEqual(System.Net.HttpStatusCode.InternalServerError, events.StatusCode);
        }