public void CharacterMining_successfully_returns_a_listV1IndustryCharacterMining() { Mock <IWebClient> mockedWebClient = new Mock <IWebClient>(); int characterId = 828658; string characterName = "ThisIsACharacter"; IndustryScopes scopes = IndustryScopes.esi_industry_read_character_mining_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, IndustryScopesFlags = scopes }; string json = "[\r\n {\r\n \"date\": \"2017-09-19\",\r\n \"quantity\": 7004,\r\n \"solar_system_id\": 30003707,\r\n \"type_id\": 17471\r\n },\r\n {\r\n \"date\": \"2017-09-18\",\r\n \"quantity\": 5199,\r\n \"solar_system_id\": 30003707,\r\n \"type_id\": 17471\r\n }\r\n]"; mockedWebClient.Setup(x => x.Get(It.IsAny <WebHeaderCollection>(), It.IsAny <string>(), It.IsAny <int>())).Returns(new EsiModel { Model = json }); InternalLatestIndustry internalLatestIndustry = new InternalLatestIndustry(mockedWebClient.Object, string.Empty); IList <V1IndustryCharacterMining> returnModel = internalLatestIndustry.CharacterMining(inputToken, 1); Assert.Equal(2, returnModel.Count); Assert.Equal(new DateTime(2017, 09, 19), returnModel[0].Date); Assert.Equal(7004, returnModel[0].Quantity); Assert.Equal(30003707, returnModel[0].SolarSystemId); Assert.Equal(17471, returnModel[0].TypeId); Assert.Equal(new DateTime(2017, 09, 18), returnModel[1].Date); Assert.Equal(5199, returnModel[1].Quantity); Assert.Equal(30003707, returnModel[1].SolarSystemId); Assert.Equal(17471, returnModel[1].TypeId); }
public async Task CorporationObserverAsync_successfully_returns_a_listV1IndustryCorporationObserver() { Mock <IWebClient> mockedWebClient = new Mock <IWebClient>(); int characterId = 828658; string characterName = "ThisIsACharacter"; IndustryScopes scopes = IndustryScopes.esi_industry_read_corporation_mining_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, IndustryScopesFlags = scopes }; string json = "[\r\n {\r\n \"character_id\": 95465499,\r\n \"last_updated\": \"2017-09-19\",\r\n \"quantity\": 500,\r\n \"recorded_corporation_id\": 109299958,\r\n \"type_id\": 1230\r\n }\r\n]"; mockedWebClient.Setup(x => x.GetAsync(It.IsAny <WebHeaderCollection>(), It.IsAny <string>(), It.IsAny <int>())).ReturnsAsync(new EsiModel { Model = json }); InternalLatestIndustry internalLatestIndustry = new InternalLatestIndustry(mockedWebClient.Object, string.Empty); IList <V1IndustryCorporationObserver> returnModel = await internalLatestIndustry.CorporationObserverAsync(inputToken, 22, 22, 1); Assert.Single(returnModel); Assert.Equal(95465499, returnModel[0].CharacterId); Assert.Equal(new DateTime(2017, 09, 19), returnModel[0].LastUpdated); Assert.Equal(500, returnModel[0].Quantity); Assert.Equal(109299958, returnModel[0].RecordedCorporationId); Assert.Equal(1230, returnModel[0].TypeId); }
public async Task CorporationExtractionsAsync_successfully_returns_a_listV1IndustryCorporationExtractions() { Mock <IWebClient> mockedWebClient = new Mock <IWebClient>(); int characterId = 828658; string characterName = "ThisIsACharacter"; IndustryScopes scopes = IndustryScopes.esi_industry_read_corporation_mining_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, IndustryScopesFlags = scopes }; string json = "[\r\n {\r\n \"chunk_arrival_time\": \"2017-10-17T11:00:59Z\",\r\n \"extraction_start_time\": \"2017-10-11T10:37:04Z\",\r\n \"moon_id\": 40307229,\r\n \"natural_decay_time\": \"2017-10-17T14:00:59Z\",\r\n \"structure_id\": 1000000010579\r\n }\r\n]"; mockedWebClient.Setup(x => x.GetAsync(It.IsAny <WebHeaderCollection>(), It.IsAny <string>(), It.IsAny <int>())).ReturnsAsync(new EsiModel { Model = json }); InternalLatestIndustry internalLatestIndustry = new InternalLatestIndustry(mockedWebClient.Object, string.Empty); IList <V1IndustryCorporationExtractions> returnModel = await internalLatestIndustry.CorporationExtractionsAsync(inputToken, 22, 1); Assert.Single(returnModel); Assert.Equal(new DateTime(2017, 10, 17, 11, 00, 59), returnModel[0].ChunkArrivalTime); Assert.Equal(new DateTime(2017, 10, 11, 10, 37, 04), returnModel[0].ExtractionStartTime); Assert.Equal(40307229, returnModel[0].MoonId); Assert.Equal(new DateTime(2017, 10, 17, 14, 00, 59), returnModel[0].NaturalDecayTime); Assert.Equal(1000000010579, returnModel[0].StructureId); }
public void CorporationObservers_successfully_returns_a_listV1IndustryCorporationObservers() { Mock <IWebClient> mockedWebClient = new Mock <IWebClient>(); int characterId = 828658; string characterName = "ThisIsACharacter"; IndustryScopes scopes = IndustryScopes.esi_industry_read_corporation_mining_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, IndustryScopesFlags = scopes }; string json = "[\r\n {\r\n \"last_updated\": \"2017-09-19\",\r\n \"observer_id\": 1,\r\n \"observer_type\": \"structure\"\r\n }\r\n]"; mockedWebClient.Setup(x => x.Get(It.IsAny <WebHeaderCollection>(), It.IsAny <string>(), It.IsAny <int>())).Returns(new EsiModel { Model = json }); InternalLatestIndustry internalLatestIndustry = new InternalLatestIndustry(mockedWebClient.Object, string.Empty); IList <V1IndustryCorporationObservers> returnModel = internalLatestIndustry.CorporationObservers(inputToken, 22, 1); Assert.Single(returnModel); Assert.Equal(new DateTime(2017, 09, 19), returnModel[0].LastUpdated); Assert.Equal(1, returnModel[0].ObserverId); Assert.Equal(V1IndustryCorporationObserversType.Structure, returnModel[0].ObserverType); }
public void CharacterMining_successfully_returns_a_listV1IndustryCharacterMining() { int characterId = 828658; string characterName = "ThisIsACharacter"; IndustryScopes scopes = IndustryScopes.esi_industry_read_character_mining_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, IndustryScopesFlags = scopes }; LatestIndustryEndpoints internalLatestIndustry = new LatestIndustryEndpoints(string.Empty, true); IList <V1IndustryCharacterMining> returnModel = internalLatestIndustry.CharacterMining(inputToken, 1); Assert.Equal(2, returnModel.Count); Assert.Equal(new DateTime(2017, 09, 19), returnModel[0].Date); Assert.Equal(7004, returnModel[0].Quantity); Assert.Equal(30003707, returnModel[0].SolarSystemId); Assert.Equal(17471, returnModel[0].TypeId); Assert.Equal(new DateTime(2017, 09, 18), returnModel[1].Date); Assert.Equal(5199, returnModel[1].Quantity); Assert.Equal(30003707, returnModel[1].SolarSystemId); Assert.Equal(17471, returnModel[1].TypeId); }
public async Task CharacterAsync_successfully_returns_a_listV1IndustryCharacter() { int characterId = 828658; string characterName = "ThisIsACharacter"; IndustryScopes scopes = IndustryScopes.esi_industry_read_character_jobs_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, IndustryScopesFlags = scopes }; LatestIndustryEndpoints internalLatestIndustry = new LatestIndustryEndpoints(string.Empty, true); IList <V1IndustryCharacter> returnModel = await internalLatestIndustry.CharacterAsync(inputToken, false); Assert.Single(returnModel); Assert.Equal(1, returnModel[0].ActivityId); Assert.Equal(1015116533326, returnModel[0].BlueprintId); Assert.Equal(60006382, returnModel[0].BlueprintLocationId); Assert.Equal(2047, returnModel[0].BlueprintTypeId); Assert.Equal(118.01, returnModel[0].Cost); Assert.Equal(548, returnModel[0].Duration); Assert.Equal(new DateTime(2014, 07, 19, 15, 56, 14), returnModel[0].EndDate); Assert.Equal(60006382, returnModel[0].FacilityId); Assert.Equal(498338451, returnModel[0].InstallerId); Assert.Equal(229136101, returnModel[0].JobId); Assert.Equal(200, returnModel[0].LicensedRuns); Assert.Equal(60006382, returnModel[0].OutputLocationId); Assert.Equal(1, returnModel[0].Runs); Assert.Equal(new DateTime(2014, 07, 19, 15, 47, 06), returnModel[0].StartDate); Assert.Equal(60006382, returnModel[0].StationId); Assert.Equal(V1IndustryCharacterStatus.Active, returnModel[0].Status); }
public static void CheckToken(SsoToken token, IndustryScopes scope) { if (token == null) { throw new EsiException("Token can not be null"); } if (token.IndustryScopesFlags == IndustryScopes.None || !token.IndustryScopesFlags.HasFlag(scope)) { throw new EsiException($"This token does not have {scope} it has: {token.IndustryScopesFlags}"); } }
public async Task CorporationObserversAsync_successfully_returns_a_listV1IndustryCorporationObservers() { int characterId = 828658; string characterName = "ThisIsACharacter"; IndustryScopes scopes = IndustryScopes.esi_industry_read_corporation_mining_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, IndustryScopesFlags = scopes }; LatestIndustryEndpoints internalLatestIndustry = new LatestIndustryEndpoints(string.Empty, true); IList <V1IndustryCorporationObservers> returnModel = await internalLatestIndustry.CorporationObserversAsync(inputToken, 22, 1); Assert.Single(returnModel); Assert.Equal(new DateTime(2017, 09, 19), returnModel[0].LastUpdated); Assert.Equal(1, returnModel[0].ObserverId); Assert.Equal(V1IndustryCorporationObserversType.Structure, returnModel[0].ObserverType); }
public async Task CharacterAsync_successfully_returns_a_listV1IndustryCharacter() { Mock <IWebClient> mockedWebClient = new Mock <IWebClient>(); int characterId = 828658; string characterName = "ThisIsACharacter"; IndustryScopes scopes = IndustryScopes.esi_industry_read_character_jobs_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, IndustryScopesFlags = scopes }; string json = "[\r\n {\r\n \"activity_id\": 1,\r\n \"blueprint_id\": 1015116533326,\r\n \"blueprint_location_id\": 60006382,\r\n \"blueprint_type_id\": 2047,\r\n \"cost\": 118.01,\r\n \"duration\": 548,\r\n \"end_date\": \"2014-07-19T15:56:14Z\",\r\n \"facility_id\": 60006382,\r\n \"installer_id\": 498338451,\r\n \"job_id\": 229136101,\r\n \"licensed_runs\": 200,\r\n \"output_location_id\": 60006382,\r\n \"runs\": 1,\r\n \"start_date\": \"2014-07-19T15:47:06Z\",\r\n \"station_id\": 60006382,\r\n \"status\": \"active\"\r\n }\r\n]"; mockedWebClient.Setup(x => x.GetAsync(It.IsAny <WebHeaderCollection>(), It.IsAny <string>(), It.IsAny <int>())).ReturnsAsync(new EsiModel { Model = json }); InternalLatestIndustry internalLatestIndustry = new InternalLatestIndustry(mockedWebClient.Object, string.Empty); IList <V1IndustryCharacter> returnModel = await internalLatestIndustry.CharacterAsync(inputToken, false); Assert.Single(returnModel); Assert.Equal(1, returnModel[0].ActivityId); Assert.Equal(1015116533326, returnModel[0].BlueprintId); Assert.Equal(60006382, returnModel[0].BlueprintLocationId); Assert.Equal(2047, returnModel[0].BlueprintTypeId); Assert.Equal(118.01, returnModel[0].Cost); Assert.Equal(548, returnModel[0].Duration); Assert.Equal(new DateTime(2014, 07, 19, 15, 56, 14), returnModel[0].EndDate); Assert.Equal(60006382, returnModel[0].FacilityId); Assert.Equal(498338451, returnModel[0].InstallerId); Assert.Equal(229136101, returnModel[0].JobId); Assert.Equal(200, returnModel[0].LicensedRuns); Assert.Equal(60006382, returnModel[0].OutputLocationId); Assert.Equal(1, returnModel[0].Runs); Assert.Equal(new DateTime(2014, 07, 19, 15, 47, 06), returnModel[0].StartDate); Assert.Equal(60006382, returnModel[0].StationId); Assert.Equal(V1IndustryCharacterStatus.Active, returnModel[0].Status); }
public void CorporationObserver_successfully_returns_a_listV1IndustryCorporationObserver() { int characterId = 828658; string characterName = "ThisIsACharacter"; IndustryScopes scopes = IndustryScopes.esi_industry_read_corporation_mining_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, IndustryScopesFlags = scopes }; LatestIndustryEndpoints internalLatestIndustry = new LatestIndustryEndpoints(string.Empty, true); IList <V1IndustryCorporationObserver> returnModel = internalLatestIndustry.CorporationObserver(inputToken, 22, 22, 1); Assert.Single(returnModel); Assert.Equal(95465499, returnModel[0].CharacterId); Assert.Equal(new DateTime(2017, 09, 19), returnModel[0].LastUpdated); Assert.Equal(500, returnModel[0].Quantity); Assert.Equal(109299958, returnModel[0].RecordedCorporationId); Assert.Equal(1230, returnModel[0].TypeId); }
public async Task CorporationExtractionsAsync_successfully_returns_a_listV1IndustryCorporationExtractions() { int characterId = 828658; string characterName = "ThisIsACharacter"; IndustryScopes scopes = IndustryScopes.esi_industry_read_corporation_mining_v1; SsoToken inputToken = new SsoToken { AccessToken = "This is a old access token", RefreshToken = "This is a old refresh token", CharacterId = characterId, CharacterName = characterName, IndustryScopesFlags = scopes }; LatestIndustryEndpoints internalLatestIndustry = new LatestIndustryEndpoints(string.Empty, true); IList <V1IndustryCorporationExtractions> returnModel = await internalLatestIndustry.CorporationExtractionsAsync(inputToken, 22, 1); Assert.Single(returnModel); Assert.Equal(new DateTime(2017, 10, 17, 11, 00, 59), returnModel[0].ChunkArrivalTime); Assert.Equal(new DateTime(2017, 10, 11, 10, 37, 04), returnModel[0].ExtractionStartTime); Assert.Equal(40307229, returnModel[0].MoonId); Assert.Equal(new DateTime(2017, 10, 17, 14, 00, 59), returnModel[0].NaturalDecayTime); Assert.Equal(1000000010579, returnModel[0].StructureId); }