public static void CheckToken(SsoToken token, UniverseScopes scope) { if (token == null) { throw new EsiException("Token can not be null"); } if (token.UniverseScopesFlags == UniverseScopes.None || !token.UniverseScopesFlags.HasFlag(scope)) { throw new EsiException($"This token does not have {scope} it has: {token.UniverseScopesFlags}"); } }
public async Task StructureAsync_successfully_returns_a_structure() { UniverseScopes scopes = UniverseScopes.esi_universe_read_structures_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = 33434, CharacterName = "sbla", UniverseScopesFlags = scopes }; LatestUniverseEndpoints internalLatestUniverse = new LatestUniverseEndpoints(string.Empty, true); V2UniverseStructure returnModel = await internalLatestUniverse.StructureAsync(inputToken, int.MinValue); Assert.NotNull(returnModel); Assert.Equal("V-3YG7 VI - The Capital", returnModel.Name); Assert.Equal(30000142, returnModel.SolarSystemId); }