public void Skills_successfully_returns_a_Skills() { Mock <IWebClient> mockedWebClient = new Mock <IWebClient>(); int characterId = 828658; string characterName = "ThisIsACharacter"; SkillScopes scopes = SkillScopes.esi_skills_read_skills_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, SkillScopesFlags = scopes }; string json = "{\"skills\": [{\"current_skill_level\": 1,\"skill_id\": 1,\"skillpoints_in_skill\": 10000},{\"current_skill_level\": 1,\"skill_id\": 2,\"skillpoints_in_skill\": 10000}],\"total_sp\": 20000}"; mockedWebClient.Setup(x => x.Get(It.IsAny <WebHeaderCollection>(), It.IsAny <string>(), It.IsAny <int>())).Returns(new EsiModel { Model = json }); InternalLatestSkills internalLatestSkills = new InternalLatestSkills(mockedWebClient.Object, string.Empty); V4SkillsSkills returnModel = internalLatestSkills.Skills(inputToken); Assert.NotNull(returnModel.Skills); Assert.Equal(20000, returnModel.TotalSp); Assert.Equal(2, returnModel.Skills.Count); Assert.Equal(10000, returnModel.Skills.First().SkillpointsInSkill); }
public static string GetText(SkillScopes scope) { string _TmpReturn = ""; if ((scope & SkillScopes.None) == SkillScopes.None) { _TmpReturn += "None,"; } if ((scope & SkillScopes.Self) == SkillScopes.Self) { _TmpReturn += "Self,"; } if ((scope & SkillScopes.Ally) == SkillScopes.Ally) { _TmpReturn += "Ally,"; } if ((scope & SkillScopes.Enemy) == SkillScopes.Enemy) { _TmpReturn += "Enemy,"; } if ((scope & SkillScopes.Object) == SkillScopes.Object) { _TmpReturn += "Object,"; } if ((scope & SkillScopes.Alive) == SkillScopes.Alive) { _TmpReturn += "Alive,"; } if ((scope & SkillScopes.Dead) == SkillScopes.Dead) { _TmpReturn += "Dead,"; } return(_TmpReturn.Substring(0, _TmpReturn.Length - 1)); }
public static void CheckToken(SsoToken token, SkillScopes scope) { if (token == null) { throw new EsiException("Token can not be null"); } if (token.SkillScopesFlags == SkillScopes.None || !token.SkillScopesFlags.HasFlag(scope)) { throw new EsiException($"This token does not have {scope} it has: {token.SkillScopesFlags}"); } }
public void GetAttributes_successfully_returns_a_Attributes() { int characterId = 828658; string characterName = "ThisIsACharacter"; SkillScopes scopes = SkillScopes.esi_skills_read_skills_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, SkillScopesFlags = scopes }; LatestSkillsEndpoints internalLatestSkills = new LatestSkillsEndpoints(string.Empty, true); V1SkillsAttributes returnModel = internalLatestSkills.Attributes(inputToken); Assert.Equal(20, returnModel.Charisma); }
public async Task GetSkillQueueAsync_successfully_returns_a_SkillQueue() { int characterId = 828658; string characterName = "ThisIsACharacter"; SkillScopes scopes = SkillScopes.esi_skills_read_skillqueue_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, SkillScopesFlags = scopes }; LatestSkillsEndpoints internalLatestSkills = new LatestSkillsEndpoints(string.Empty, true); IList <V2SkillsSkillQueue> returnModel = await internalLatestSkills.SkillQueueAsync(inputToken); Assert.Equal(3, returnModel.Count); Assert.Equal(1, returnModel.First().SkillId); }
public async Task GetSkillsAsync_successfully_returns_a_Skills() { int characterId = 828658; string characterName = "ThisIsACharacter"; SkillScopes scopes = SkillScopes.esi_skills_read_skills_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, SkillScopesFlags = scopes }; LatestSkillsEndpoints internalLatestSkills = new LatestSkillsEndpoints(string.Empty, true); V4SkillsSkills returnModel = await internalLatestSkills.SkillsAsync(inputToken); Assert.NotNull(returnModel.Skills); Assert.Equal(20000, returnModel.TotalSp); Assert.Equal(2, returnModel.Skills.Count); Assert.Equal(10000, returnModel.Skills.First().SkillpointsInSkill); }
public async Task AttributesAsync_successfully_returns_a_Attributes() { Mock <IWebClient> mockedWebClient = new Mock <IWebClient>(); int characterId = 828658; string characterName = "ThisIsACharacter"; SkillScopes scopes = SkillScopes.esi_skills_read_skills_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, SkillScopesFlags = scopes }; string json = "{\"charisma\": 20,\"intelligence\": 20,\"memory\": 20,\"perception\": 20,\"willpower\": 20}"; mockedWebClient.Setup(x => x.GetAsync(It.IsAny <WebHeaderCollection>(), It.IsAny <string>(), It.IsAny <int>())).ReturnsAsync(new EsiModel { Model = json }); InternalLatestSkills internalLatestSkills = new InternalLatestSkills(mockedWebClient.Object, string.Empty); V1SkillsAttributes returnModel = await internalLatestSkills.AttributesAsync(inputToken); Assert.Equal(20, returnModel.Charisma); }
public async Task SkillQueueAsync_successfully_returns_a_SkillQueue() { Mock <IWebClient> mockedWebClient = new Mock <IWebClient>(); int characterId = 828658; string characterName = "ThisIsACharacter"; SkillScopes scopes = SkillScopes.esi_skills_read_skillqueue_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, SkillScopesFlags = scopes }; string json = "[{\"finish_date\": \"2016-06-29T10:47:00Z\",\"finished_level\": 3,\"queue_position\": 0,\"skill_id\": 1,\"start_date\": \"2016-06-29T10:46:00Z\"},{\"finish_date\": \"2016-07-15T10:47:00Z\", \"finished_level\": 4,\"queue_position\": 1,\"skill_id\": 1,\"start_date\": \"2016-06-29T10:47:00Z\"},{\"finish_date\": \"2016-08-30T10:47:00Z\",\"finished_level\": 2,\"queue_position\": 2,\"skill_id\": 2,\"start_date\": \"2016-07-15T10:47:00Z\"}]"; mockedWebClient.Setup(x => x.GetAsync(It.IsAny <WebHeaderCollection>(), It.IsAny <string>(), It.IsAny <int>())).ReturnsAsync(new EsiModel { Model = json }); InternalLatestSkills internalLatestSkills = new InternalLatestSkills(mockedWebClient.Object, string.Empty); IList <V2SkillsSkillQueue> returnModel = await internalLatestSkills.SkillQueueAsync(inputToken); Assert.Equal(3, returnModel.Count); Assert.Equal(1, returnModel.First().SkillId); }