Beispiel #1
0
        public void Event_successfully_returns_a_V3CalendarEvent()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int            characterId   = 828658;
            string         characterName = "ThisIsACharacter";
            CalendarScopes scopes        = CalendarScopes.esi_calendar_read_calendar_events_v1;

            SsoToken inputToken = new SsoToken {
                AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, CalendarScopesFlags = scopes
            };
            string json = "{\r\n  \"date\": \"2016-06-26T21:00:00Z\",\r\n  \"duration\": 60,\r\n  \"event_id\": 1386435,\r\n  \"importance\": 1,\r\n  \"owner_id\": 1,\r\n  \"owner_name\": \"EVE System\",\r\n  \"owner_type\": \"eve_server\",\r\n  \"response\": \"Undecided\",\r\n  \"text\": \"o7: The EVE Online Show features latest developer news, fast paced action, community overviews and a lot more with CCP Guard and CCP Mimic. Join the thrilling o7 live broadcast at 20:00 EVE time (=UTC) on <a href=\\\"http://www.twitch.tv/ccp\\\">EVE TV</a>. Don\'t miss it!\",\r\n  \"title\": \"o7 The EVE Online Show\"\r\n}";

            mockedWebClient.Setup(x => x.Get(It.IsAny <WebHeaderCollection>(), It.IsAny <string>(), It.IsAny <int>())).Returns(new EsiModel {
                Model = json
            });

            InternalLatestCalendar internalLatestCalendar = new InternalLatestCalendar(mockedWebClient.Object, string.Empty);

            V3CalendarEvent returnModel = internalLatestCalendar.Event(inputToken, 1);

            Assert.Equal(new DateTime(2016, 06, 26, 21, 00, 00), returnModel.Date);
            Assert.Equal(60, returnModel.Duration);
            Assert.Equal(1386435, returnModel.EventId);
            Assert.Equal(1, returnModel.Importance);
            Assert.Equal("EVE System", returnModel.OwnerName);
            Assert.Equal(V3CalendarEventOwnerType.EveServer, returnModel.OwnerType);
            Assert.Equal("Undecided", returnModel.Response);
            Assert.Equal("o7: The EVE Online Show features latest developer news, fast paced action, community overviews and a lot more with CCP Guard and CCP Mimic. Join the thrilling o7 live broadcast at 20:00 EVE time (=UTC) on <a href=\"http://www.twitch.tv/ccp\">EVE TV</a>. Don't miss it!", returnModel.Text);
            Assert.Equal("o7 The EVE Online Show", returnModel.Title);
        }
        public async Task EventAsync_successfully_returns_a_V3CalendarEvent()
        {
            int            characterId   = 828658;
            string         characterName = "ThisIsACharacter";
            CalendarScopes scopes        = CalendarScopes.esi_calendar_read_calendar_events_v1;

            SsoToken inputToken = new SsoToken {
                AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, CalendarScopesFlags = scopes
            };

            LatestCalendarEndpoints internalLatestCalendar = new LatestCalendarEndpoints(string.Empty, true);

            V3CalendarEvent returnModel = await internalLatestCalendar.EventAsync(inputToken, 1);

            Assert.Equal(new DateTime(2016, 06, 26, 21, 00, 00), returnModel.Date);
            Assert.Equal(60, returnModel.Duration);
            Assert.Equal(1386435, returnModel.EventId);
            Assert.Equal(1, returnModel.Importance);
            Assert.Equal("EVE System", returnModel.OwnerName);
            Assert.Equal(V3CalendarEventOwnerType.EveServer, returnModel.OwnerType);
            Assert.Equal("Undecided", returnModel.Response);
            Assert.Equal("o7: The EVE Online Show features latest developer news, fast paced action, community overviews and a lot more with CCP Guard and CCP Mimic. Join the thrilling o7 live broadcast at 20:00 EVE time (=UTC) on <a href=\"http://www.twitch.tv/ccp\">EVE TV</a>. Don't miss it!", returnModel.Text);
            Assert.Equal("o7 The EVE Online Show", returnModel.Title);
        }