コード例 #1
0
        public async Task OnlineAsync_Successfully_returns_a_V2LocationOnline()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int            characterId = 8976562;
            LocationScopes scopes      = LocationScopes.esi_location_read_online_v1;

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

            string json = "{\r\n  \"last_login\": \"2017-01-02T03:04:05Z\",\r\n  \"last_logout\": \"2017-01-02T04:05:06Z\",\r\n  \"logins\": 9001,\r\n  \"online\": true\r\n}";

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

            InternalLatestLocation internalLatestLocation = new InternalLatestLocation(mockedWebClient.Object, string.Empty);

            V2LocationOnline returnModel = await internalLatestLocation.OnlineAsync(inputToken);

            Assert.Equal(new DateTime(2017, 01, 02, 03, 04, 05), returnModel.LastLogin);
            Assert.Equal(new DateTime(2017, 01, 02, 04, 05, 06), returnModel.LastLogout);
            Assert.Equal(9001, returnModel.Logins);
            Assert.True(returnModel.Online);
        }
コード例 #2
0
        public async Task OnlineAsync_Successfully_returns_a_V2LocationOnline()
        {
            int            characterId = 8976562;
            LocationScopes scopes      = LocationScopes.esi_location_read_online_v1;

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

            LatestLocationEndpoints internalLatestLocation = new LatestLocationEndpoints(string.Empty, true);

            V2LocationOnline returnModel = await internalLatestLocation.OnlineAsync(inputToken);

            Assert.Equal(new DateTime(2017, 01, 02, 03, 04, 05), returnModel.LastLogin);
            Assert.Equal(new DateTime(2017, 01, 02, 04, 05, 06), returnModel.LastLogout);
            Assert.Equal(9001, returnModel.Logins);
            Assert.True(returnModel.Online);
        }