public async Task CharacterStatsAsync_successfully_returns_a_V1FwCharacterStats()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int             characterId   = 828658;
            string          characterName = "ThisIsACharacter";
            CharacterScopes scopes        = CharacterScopes.esi_characters_read_fw_stats_v1;

            SsoToken inputToken = new SsoToken {
                AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, CharacterScopesFlags = scopes
            };
            string json = "{\r\n  \"enlisted_on\": \"2017-10-17T00:00:00Z\",\r\n  \"faction_id\": 500001,\r\n  \"kills\": {\r\n    \"last_week\": 893,\r\n    \"total\": 684350,\r\n    \"yesterday\": 136\r\n  },\r\n  \"victory_points\": {\r\n    \"last_week\": 102640,\r\n    \"total\": 52658260,\r\n    \"yesterday\": 15980\r\n  }\r\n}";

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

            InternalLatestFactionWarfare internalLatestFactionWarfare = new InternalLatestFactionWarfare(mockedWebClient.Object, string.Empty);

            V1FwCharacterStats result = await internalLatestFactionWarfare.CharacterStatsAsync(inputToken);

            Assert.Equal(new DateTime(2017, 10, 17, 00, 00, 00), result.EnlistedOn);
            Assert.Equal(500001, result.FactionId);
            Assert.Equal(893, result.Kills.LastWeek);
            Assert.Equal(684350, result.Kills.Total);
            Assert.Equal(136, result.Kills.Yesterday);
            Assert.Equal(102640, result.VictoryPoints.LastWeek);
            Assert.Equal(52658260, result.VictoryPoints.Total);
            Assert.Equal(15980, result.VictoryPoints.Yesterday);
        }
        public async Task CharacterAddAsync_successfully_returns_a_IListint()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_write_contacts_v1;

            SsoToken inputToken = new SsoToken {
                AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterScopesFlags = scopes
            };
            string json = "[\r\n  123,\r\n  456\r\n]";

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

            InternalLatestContacts internalLatestContacts = new InternalLatestContacts(mockedWebClient.Object, string.Empty);

            V2ContactCharacterAdd model = new V2ContactCharacterAdd
            {
                Standing = 9.9f
            };

            IList <int> returnModel = await internalLatestContacts.CharacterAddAsync(inputToken, model);

            Assert.Equal(123, returnModel[0]);
            Assert.Equal(456, returnModel[1]);
        }
        public async Task ContactNotificationsAsync_successfully_returns_a_list_of_V1CharactersNotificationsContacts()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_notifications_v1;

            SsoToken inputToken = new SsoToken {
                AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterScopesFlags = scopes
            };
            string json = "[{\"notification_id\": 1,\"sender_character_id\": 95465499,\"send_date\": \"2017-08-16T10:08:00Z\",\"standing_level\": 1.5,\"message\": \"hello friend :3\"}]";

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

            InternalLatestCharacter internalLatestCharacter = new InternalLatestCharacter(mockedWebClient.Object, string.Empty);

            IList <V1CharactersNotificationsContacts> getCharactersNotificationsContacts = await internalLatestCharacter.ContactNotificationsAsync(inputToken);

            Assert.Equal(1, getCharactersNotificationsContacts.Count);
            Assert.Equal(1, getCharactersNotificationsContacts.First().NotificationId);
            Assert.Equal(95465499, getCharactersNotificationsContacts.First().SenderCharacterId);
            Assert.Equal(new DateTime(2017, 08, 16, 10, 08, 00), getCharactersNotificationsContacts.First().SendDate);
            Assert.Equal(1.5, getCharactersNotificationsContacts.First().StandingLevel);
        }
        public async Task StatsAsync_successfully_returns_a_list_of_V2CharactersStats()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characterstats_read_v1;

            SsoToken inputToken = new SsoToken {
                AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterScopesFlags = scopes
            };
            string json = "[{\"year\": 2014,\"character\": {\"days_of_activity\": 365,\"minutes\": 1000000,\"sessions_started\": 500},\"combat\": {\"kills_low_sec\": 42}},{\"year\": 2015,\"character\": {\"days_of_activity\": 365,\"minutes\": 1000000, \"sessions_started\": 500},\"combat\": {\"kills_null_sec\": 1337}}]";

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

            InternalLatestCharacter internalLatestCharacter = new InternalLatestCharacter(mockedWebClient.Object, string.Empty);

            IList <V2CharactersStats> getCharactersStats = await internalLatestCharacter.StatsAsync(inputToken);

            Assert.Equal(2, getCharactersStats.Count);
            Assert.Equal(2014, getCharactersStats.First().Year);
            Assert.Equal(365, getCharactersStats.First().Character.DaysOfActivity);
            Assert.Equal(42, getCharactersStats.First().Combat.KillsLowSec);
            Assert.Equal(365, getCharactersStats[1].Character.DaysOfActivity);
            Assert.Equal(1337, getCharactersStats[1].Combat.KillsNullSec);
        }
        public async Task MedalsAsync_successfully_returns_a_list_of_V1CharactersMedals()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_medals_v1;

            SsoToken inputToken = new SsoToken {
                AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterScopesFlags = scopes
            };
            string json = "[{\"medal_id\": 3,\"title\": \"33 tester medal\",\"description\": \"For 33 corp!\",\"corporation_id\": 98000001,\"issuer_id\": 2112000002,\"date\": \"2017-03-16T15:01:45Z\",\"reason\": \"Thanks!\",\"status\": \"private\",\"graphics\": [{\"part\": 1,\"layer\": 0,\"graphic\": \"caldari.1_1\",\"color\": -1},{\"part\": 1,\"layer\": 1,\"graphic\": \"caldari.1_2\",\"color\": -330271},{\"part\": 2,\"layer\": 0,\"graphic\": \"compass.1_2\",\"color\": -1}]}]";

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

            InternalLatestCharacter internalLatestCharacter = new InternalLatestCharacter(mockedWebClient.Object, string.Empty);

            IList <V1CharactersMedals> getCharactersMedals = await internalLatestCharacter.MedalsAsync(inputToken);

            Assert.Equal(1, getCharactersMedals.Count);
            Assert.Equal(3, getCharactersMedals.First().MedalId);
            Assert.Equal(new DateTime(2017, 03, 16, 15, 01, 45), getCharactersMedals.First().Date);
            Assert.Equal(MedalsStatus.Private, getCharactersMedals.First().Status);
            Assert.Equal(3, getCharactersMedals.First().Graphics.Count);
            Assert.Equal(1, getCharactersMedals.First().Graphics.First().Part);
            Assert.Equal(0, getCharactersMedals.First().Graphics.First().Layer);
            Assert.Equal("caldari.1_2", getCharactersMedals.First().Graphics[1].Graphic);
            Assert.Equal(-1, getCharactersMedals.First().Graphics[2].Color);
        }
        public async Task CharacterAsync_successfully_returns_a_PagedModelV2ContactCharacter()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int             characterId = 88823;
            int             page        = 1;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_contacts_v1;

            SsoToken inputToken = new SsoToken {
                AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterScopesFlags = scopes
            };
            string json = "[\r\n  {\r\n    \"contact_id\": 123,\r\n    \"contact_type\": \"character\",\r\n    \"is_blocked\": true,\r\n    \"is_watched\": true,\r\n    \"standing\": 9.9\r\n  }\r\n]";

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

            InternalLatestContacts internalLatestContacts = new InternalLatestContacts(mockedWebClient.Object, string.Empty);

            PagedModel <V2ContactCharacter> returnModel = await internalLatestContacts.CharacterAsync(inputToken, page);

            Assert.Equal(123, returnModel.Model.First().ContactId);
            Assert.Equal(V2ContactCharacterContactTypes.Character, returnModel.Model[0].ContactType);
            Assert.True(returnModel.Model[0].IsBlocked);
            Assert.True(returnModel.Model[0].IsWatched);
            Assert.Equal(9.9f, returnModel.Model[0].Standing);
        }
        public async Task RolesAsync_successfully_returns_a_V2CharacterRoles()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_corporation_roles_v1;

            SsoToken inputToken = new SsoToken {
                AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterScopesFlags = scopes
            };
            string json = "{\"roles\": [\"Director\",\"Station_Manager\"]}";

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

            InternalLatestCharacter internalLatestCharacter = new InternalLatestCharacter(mockedWebClient.Object, string.Empty);

            V2CharacterRoles getCharactersRoles = await internalLatestCharacter.RolesAsync(inputToken);

            Assert.Equal(2, getCharactersRoles.Roles.Count);
            Assert.Equal(CharacterRoles.Director, getCharactersRoles.Roles[0]);
            Assert.Equal(CharacterRoles.StationManager, getCharactersRoles.Roles[1]);
            Assert.Equal(0, getCharactersRoles.RolesAtHq.Count);
            Assert.Equal(0, getCharactersRoles.RolesAtBase.Count);
            Assert.Equal(0, getCharactersRoles.RolesAtOther.Count);
        }
        public async Task BlueprintsAsync_successfully_returns_a_list_of_V2CharactersBlueprints()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_blueprints_v1;

            SsoToken inputToken = new SsoToken {
                AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterScopesFlags = scopes
            };
            string json = "[{\"item_id\": 1000000010495,\"type_id\": 691,\"location_id\": 60014719,\"location_flag\": \"Hangar\",\"quantity\": 1,\"time_efficiency\": 0,\"material_efficiency\": 0,\"runs\": -1}]";

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

            InternalLatestCharacter internalLatestCharacter = new InternalLatestCharacter(mockedWebClient.Object, string.Empty);

            IList <V2CharactersBlueprints> getCharactersBlueprint = await internalLatestCharacter.BlueprintsAsync(inputToken);

            Assert.Equal(1, getCharactersBlueprint.Count);
            Assert.Equal(1000000010495, getCharactersBlueprint.First().ItemId);
            Assert.Equal(LocationFlagCharacter.Hangar, getCharactersBlueprint.First().LocationFlag);
            Assert.Equal(-1, getCharactersBlueprint.First().Runs);
        }
        public async Task NotificationsAsync_successfully_returns_a_list_of_V4CharactersNotifications()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_notifications_v1;

            SsoToken inputToken = new SsoToken {
                AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterScopesFlags = scopes
            };
            string json = "[{\"notification_id\": 1,\"type\": \"InsurancePayoutMsg\",\"sender_id\": 1000132,\"sender_type\": \"corporation\",\"timestamp\": \"2017-08-16T10:08:00Z\",\"is_read\": true,\"text\": \"amount: 3731016.4000000004\\\\nitemID: 1024881021663\\\\npayout: 1\\\\n\"}]";

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

            InternalLatestCharacter internalLatestCharacter = new InternalLatestCharacter(mockedWebClient.Object, string.Empty);

            IList <V5CharactersNotifications> getCharactersNotifications = await internalLatestCharacter.NotificationsAsync(inputToken);

            Assert.Equal(1, getCharactersNotifications.Count);
            Assert.Equal(1, getCharactersNotifications.First().NotificationId);
            Assert.Equal(V5CharactersNotificationType.InsurancePayoutMsg, getCharactersNotifications.First().Type);
            Assert.Equal(SenderType.Corporation, getCharactersNotifications.First().SenderType);
            Assert.Equal(new DateTime(2017, 08, 16, 10, 08, 00), getCharactersNotifications.First().Timestamp);
            Assert.True(getCharactersNotifications.First().IsRead);
        }
Exemple #10
0
        public async Task PointsAsync_successfully_returns_a_listV1LoyaltyPoint()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int             characterId = 8976562;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_loyalty_v1;

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

            string json = "[\r\n  {\r\n    \"corporation_id\": 123,\r\n    \"loyalty_points\": 100\r\n  }\r\n]";

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

            InternalLatestLoyalty internalLatestLoyalty = new InternalLatestLoyalty(mockedWebClient.Object, string.Empty);

            IList <V1LoyaltyPoint> returnModel = await internalLatestLoyalty.PointsAsync(inputToken);

            Assert.NotNull(returnModel);

            Assert.Single(returnModel);

            Assert.Equal(123, returnModel[0].CorporationId);
            Assert.Equal(100, returnModel[0].LoyaltyPoints);
        }
Exemple #11
0
        public async Task CharacterAsync_successfully_returns_a_listV1OpportunitiesCharacter()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_opportunities_v1;

            SsoToken inputToken = new SsoToken {
                AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterScopesFlags = scopes
            };
            string json = "[\r\n  {\r\n    \"completed_at\": \"2016-04-29T12:34:56Z\",\r\n    \"task_id\": 1\r\n  }\r\n]";

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

            InternalLatestOpportunities internalLatestOpportunities = new InternalLatestOpportunities(mockedWebClient.Object, string.Empty);

            IList <V1OpportunitiesCharacter> returnModel = await internalLatestOpportunities.CharacterAsync(inputToken);

            Assert.Single(returnModel);

            Assert.Equal(new DateTime(2016, 04, 29, 12, 34, 56), returnModel[0].CompletedAt);
            Assert.Equal(1, returnModel[0].TaskId);
        }
        public async Task StandingsAsync_successfully_returns_a_list_of_V2CharactersStandings()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_standings_v1;

            SsoToken inputToken = new SsoToken {
                AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterScopesFlags = scopes
            };
            string json = "[{\"from_id\": 3009841,\"from_type\": \"agent\",\"standing\": 0.1},{\"from_id\": 1000061,\"from_type\": \"npc_corp\",\"standing\": 0},{\"from_id\": 500003,\"from_type\": \"faction\",\"standing\": -1}]";

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

            InternalLatestCharacter internalLatestCharacter = new InternalLatestCharacter(mockedWebClient.Object, string.Empty);

            IList <V2CharactersStandings> getCharactersStandings = await internalLatestCharacter.StandingsAsync(inputToken);

            Assert.Equal(3, getCharactersStandings.Count);
            Assert.Equal(3009841, getCharactersStandings.First().FromId);
            Assert.Equal(StandingFromType.Agent, getCharactersStandings.First().FromType);
            Assert.Equal(0.1f, getCharactersStandings.First().Standing);
            Assert.Equal(StandingFromType.NpcCorp, getCharactersStandings[1].FromType);
            Assert.Equal(StandingFromType.Faction, getCharactersStandings[2].FromType);
        }
Exemple #13
0
        public static void CheckToken(SsoToken token, CharacterScopes scope)
        {
            if (token == null)
            {
                throw new EsiException("Token can not be null");
            }

            if (token.CharacterScopesFlags == CharacterScopes.None || !token.CharacterScopesFlags.HasFlag(scope))
            {
                throw new EsiException($"This token does not have {scope} it has: {token.CharacterScopesFlags}");
            }
        }
        public void CharacterDelete_successfully_returns_nothing()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_write_contacts_v1;

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

            LatestContactsEndpoints internalLatestContacts = new LatestContactsEndpoints(string.Empty, true);

            internalLatestContacts.CharacterDelete(inputToken, new List <int>());
        }
        public async Task CharacterLabelsAsync_successfully_returns_a_IListV1ContactCharacterLabel()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_contacts_v1;

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

            LatestContactsEndpoints internalLatestContacts = new LatestContactsEndpoints(string.Empty, true);

            IList <V1ContactCharacterLabel> returnModel = await internalLatestContacts.CharacterLabelsAsync(inputToken);

            Assert.Equal(123, returnModel.First().LabelId);
            Assert.Equal("Friends", returnModel.First().LabelName);
        }
        public async Task CspaCostAsync_successfully_returns_a_float()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_contacts_v1;
            IList <int>     characters  = new List <int>(2);

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

            LatestCharacterEndpoints internalLatestCharacter = new LatestCharacterEndpoints(string.Empty, true);

            float getCharactersCspaCost = await internalLatestCharacter.CspaCostAsync(inputToken, characters);

            Assert.Equal(2950, getCharactersCspaCost);
        }
        public async Task ResearchAgentsAsync_successfully_returns_a_list_of_V1CharactersResearchAgents()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_agents_research_v1;

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

            LatestCharacterEndpoints internalLatestCharacter = new LatestCharacterEndpoints(string.Empty, true);

            IList <V1CharactersResearchAgents> getCharactersResearchAgents = await internalLatestCharacter.ResearchAgentsAsync(inputToken);

            Assert.Equal(1, getCharactersResearchAgents.Count);
            Assert.Equal(3009358, getCharactersResearchAgents.First().AgentId);
            Assert.Equal(new DateTime(2017, 03, 23, 14, 47, 00), getCharactersResearchAgents.First().StartedAt);
        }
        public async Task TitlesAsync_successfully_returns_a_list_of_V1CharacterTitles()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_titles_v1;

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

            LatestCharacterEndpoints internalLatestCharacter = new LatestCharacterEndpoints(string.Empty, true);

            IList <V1CharacterTitles> getCharactersTitles = await internalLatestCharacter.TitlesAsync(inputToken);

            Assert.Equal(1, getCharactersTitles.Count);
            Assert.Equal(1, getCharactersTitles.First().TitleId);
            Assert.Equal("Awesome Title", getCharactersTitles.First().Name);
        }
        public async Task FatigueAsync_successfully_returns_a_V1CharactersFatigue()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_fatigue_v1;

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

            LatestCharacterEndpoints internalLatestCharacter = new LatestCharacterEndpoints(string.Empty, true);

            V1CharactersFatigue getCharactersFatigue = await internalLatestCharacter.FatigueAsync(inputToken);

            Assert.Equal(new DateTime(2017, 07, 05, 15, 47, 00), getCharactersFatigue.LastJumpDate);
            Assert.Equal(new DateTime(2017, 07, 06, 15, 47, 00), getCharactersFatigue.JumpFatigueExpireDate);
            Assert.Equal(new DateTime(2017, 07, 05, 15, 42, 00), getCharactersFatigue.LastUpdateDate);
        }
        public async Task BlueprintsAsync_successfully_returns_a_list_of_V2CharactersBlueprints()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_blueprints_v1;

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

            LatestCharacterEndpoints internalLatestCharacter = new LatestCharacterEndpoints(string.Empty, true);

            IList <V2CharactersBlueprints> getCharactersBlueprint = await internalLatestCharacter.BlueprintAsync(inputToken);

            Assert.Equal(1, getCharactersBlueprint.Count);
            Assert.Equal(1000000010495, getCharactersBlueprint.First().ItemId);
            Assert.Equal(LocationFlagCharacter.Hangar, getCharactersBlueprint.First().LocationFlag);
            Assert.Equal(-1, getCharactersBlueprint.First().Runs);
        }
Exemple #21
0
        public async Task CharacterAsync_successfully_returns_a_listV1OpportunitiesCharacter()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_opportunities_v1;

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

            LatestOpportunitiesEndpoints internalLatestOpportunities = new LatestOpportunitiesEndpoints(string.Empty, true);

            IList <V1OpportunitiesCharacter> returnModel = await internalLatestOpportunities.CharacterAsync(inputToken);

            Assert.Single(returnModel);

            Assert.Equal(new DateTime(2016, 04, 29, 12, 34, 56), returnModel[0].CompletedAt);
            Assert.Equal(1, returnModel[0].TaskId);
        }
        public async Task CharacterEditAsync_successfully_returns_nothing()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_write_contacts_v1;

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

            LatestContactsEndpoints internalLatestContacts = new LatestContactsEndpoints(string.Empty, true);

            V2ContactCharacterEdit model = new V2ContactCharacterEdit
            {
                Standing = 9.9f
            };

            await internalLatestContacts.CharacterEditAsync(inputToken, model);
        }
        public async Task ContactNotificationsAsync_successfully_returns_a_list_of_V1CharactersNotificationsContacts()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_notifications_v1;

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

            LatestCharacterEndpoints internalLatestCharacter = new LatestCharacterEndpoints(string.Empty, true);

            IList <V1CharactersNotificationsContacts> getCharactersNotificationsContacts = await internalLatestCharacter.ContactNotificationsAsync(inputToken);

            Assert.Equal(1, getCharactersNotificationsContacts.Count);
            Assert.Equal(1, getCharactersNotificationsContacts.First().NotificationId);
            Assert.Equal(95465499, getCharactersNotificationsContacts.First().SenderCharacterId);
            Assert.Equal(new DateTime(2017, 08, 16, 10, 08, 00), getCharactersNotificationsContacts.First().SendDate);
            Assert.Equal(1.5, getCharactersNotificationsContacts.First().StandingLevel);
        }
        public async Task StandingsAsync_successfully_returns_a_list_of_V2CharactersStandings()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_standings_v1;

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

            LatestCharacterEndpoints internalLatestCharacter = new LatestCharacterEndpoints(string.Empty, true);

            IList <V2CharactersStandings> getCharactersStandings = await internalLatestCharacter.StandingsAsync(inputToken);

            Assert.Equal(3, getCharactersStandings.Count);
            Assert.Equal(3009841, getCharactersStandings.First().FromId);
            Assert.Equal(StandingFromType.Agent, getCharactersStandings.First().FromType);
            Assert.Equal(0.1f, getCharactersStandings.First().Standing);
            Assert.Equal(StandingFromType.NpcCorp, getCharactersStandings[1].FromType);
            Assert.Equal(StandingFromType.Faction, getCharactersStandings[2].FromType);
        }
        public async Task StatsAsync_successfully_returns_a_list_of_V2CharactersStats()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characterstats_read_v1;

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

            LatestCharacterEndpoints internalLatestCharacter = new LatestCharacterEndpoints(string.Empty, true);

            IList <V2CharactersStats> getCharactersStats = await internalLatestCharacter.StatsAsync(inputToken);

            Assert.Equal(2, getCharactersStats.Count);
            Assert.Equal(2014, getCharactersStats.First().Year);
            Assert.Equal(365, getCharactersStats.First().Character.DaysOfActivity);
            Assert.Equal(42, getCharactersStats.First().Combat.KillsLowSec);
            Assert.Equal(365, getCharactersStats[1].Character.DaysOfActivity);
            Assert.Equal(1337, getCharactersStats[1].Combat.KillsNullSec);
        }
        public async Task NotificationsAsync_successfully_returns_a_list_of_V4CharactersNotifications()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_notifications_v1;

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

            LatestCharacterEndpoints internalLatestCharacter = new LatestCharacterEndpoints(string.Empty, true);

            IList <V5CharactersNotifications> getCharactersNotifications = await internalLatestCharacter.NotificationsAsync(inputToken);

            Assert.Equal(1, getCharactersNotifications.Count);
            Assert.Equal(1, getCharactersNotifications.First().NotificationId);
            Assert.Equal(V5CharactersNotificationType.InsurancePayoutMsg, getCharactersNotifications.First().Type);
            Assert.Equal(SenderType.Corporation, getCharactersNotifications.First().SenderType);
            Assert.Equal(new DateTime(2017, 08, 16, 10, 08, 00), getCharactersNotifications.First().Timestamp);
            Assert.True(getCharactersNotifications.First().IsRead);
        }
        public async Task CharacterAsync_successfully_returns_a_PagedModelV2ContactCharacter()
        {
            int             characterId = 88823;
            int             page        = 1;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_contacts_v1;

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

            LatestContactsEndpoints internalLatestContacts = new LatestContactsEndpoints(string.Empty, true);

            PagedModel <V2ContactCharacter> returnModel = await internalLatestContacts.CharacterAsync(inputToken, page);

            Assert.Equal(123, returnModel.Model.First().ContactId);
            Assert.Equal(V2ContactCharacterContactTypes.Character, returnModel.Model[0].ContactType);
            Assert.True(returnModel.Model[0].IsBlocked);
            Assert.True(returnModel.Model[0].IsWatched);
            Assert.Equal(9.9f, returnModel.Model[0].Standing);
        }
        public async Task RolesAsync_successfully_returns_a_V2CharacterRoles()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_corporation_roles_v1;

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

            LatestCharacterEndpoints internalLatestCharacter = new LatestCharacterEndpoints(string.Empty, true);

            V2CharacterRoles getCharactersRoles = await internalLatestCharacter.RolesAsync(inputToken);

            Assert.Equal(2, getCharactersRoles.Roles.Count);
            Assert.Equal(CharacterRoles.Director, getCharactersRoles.Roles[0]);
            Assert.Equal(CharacterRoles.StationManager, getCharactersRoles.Roles[1]);
            Assert.Equal(0, getCharactersRoles.RolesAtHq.Count);
            Assert.Equal(0, getCharactersRoles.RolesAtBase.Count);
            Assert.Equal(0, getCharactersRoles.RolesAtOther.Count);
        }
        public async Task PointsAsync_successfully_returns_a_listV1LoyaltyPoint()
        {
            int             characterId = 8976562;
            CharacterScopes scopes      = CharacterScopes.esi_characters_read_loyalty_v1;

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

            LatestLoyaltyEndpoints internalLatestLoyalty = new LatestLoyaltyEndpoints(string.Empty, true);

            IList <V1LoyaltyPoint> returnModel = await internalLatestLoyalty.PointsAsync(inputToken);

            Assert.NotNull(returnModel);

            Assert.Single(returnModel);

            Assert.Equal(123, returnModel[0].CorporationId);
            Assert.Equal(100, returnModel[0].LoyaltyPoints);
        }
        public async Task CharacterAddAsync_successfully_returns_a_IListint()
        {
            int             characterId = 88823;
            CharacterScopes scopes      = CharacterScopes.esi_characters_write_contacts_v1;

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

            LatestContactsEndpoints internalLatestContacts = new LatestContactsEndpoints(string.Empty, true);

            V2ContactCharacterAdd model = new V2ContactCharacterAdd
            {
                Standing = 9.9f
            };

            IList <int> returnModel = await internalLatestContacts.CharacterAddAsync(inputToken, model);

            Assert.Equal(123, returnModel[0]);
            Assert.Equal(456, returnModel[1]);
        }