示例#1
0
        public async Task LocationAsync_Successfully_returns_a_V1LocationLocation()
        {
            int            characterId = 8976562;
            LocationScopes scopes      = LocationScopes.esi_location_read_location_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);

            V1LocationLocation returnModel = await internalLatestLocation.LocationAsync(inputToken);

            Assert.Equal(30002505, returnModel.SolarSystemId);
            Assert.Equal(1000000016989, returnModel.StructureId);
        }
示例#2
0
        public async Task LocationAsync_Successfully_returns_a_V1LocationLocation()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int            characterId = 8976562;
            LocationScopes scopes      = LocationScopes.esi_location_read_location_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  \"solar_system_id\": 30002505,\r\n  \"structure_id\": 1000000016989\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);

            V1LocationLocation returnModel = await internalLatestLocation.LocationAsync(inputToken);

            Assert.Equal(30002505, returnModel.SolarSystemId);
            Assert.Equal(1000000016989, returnModel.StructureId);
        }