public static void CharacterInfoTest() { var url = new Uri("https://api.eveonline.com/eve/CharacterInfo.xml.aspx"); var data = new Dictionary <string, string>(); data.Add(ApiConstants.CharacterId, "1643072492"); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\CharacterInfo.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <CharacterInfo> > task = client.Eve.CharacterInfoAsync(1643072492); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); EveServiceResponse <CharacterInfo> result = task.Result; Assert.AreEqual("Catari Taga", result.ResultData.CharacterName); Assert.AreEqual(1923227030, result.ResultData.AllianceId); Assert.AreEqual(0.0, result.ResultData.SecurityStatus); } }
public static void CalendarEventAttendeeTest() { // setup mock data and parameters. var url = new Uri("https://api.eveonline.com/char/CalendarEventAttendees.xml.aspx"); const int characterId = 123456; const int eventId = 7890572; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); data.Add(ApiConstants.EventId, eventId.ToInvariantString()); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, AttendeeXml); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <CalendarEventAttendee> > > task = client.Character.CalendarEventAttendees(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId, eventId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); EveServiceResponse <IEnumerable <CalendarEventAttendee> > result = task.Result; IEnumerable <CalendarEventAttendee> resultData = result.ResultData; Assert.AreEqual(4, resultData.Count()); Assert.AreEqual(192837645, resultData.Skip(2).Take(1).First().CharacterId); Assert.AreEqual(AttendeeResponseType.Undecided, resultData.Skip(3).Take(1).First().Response); } }
public static void NPCStandingsTest() { var url = new Uri("https://api.eveonline.com/char/Standings.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\NPCStandings.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <NpcStanding> > > task = client.Character.NPCStandingsAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); Assert.IsNotNull(task.Result); Assert.IsNotEmpty(task.Result.ResultData); List <NpcStanding> standings = task.Result.ResultData.ToList(); Assert.AreEqual(7, standings.Count); NpcStanding standing = standings[3]; Assert.AreEqual(NpcType.NPCCorporations, standing.Kind); Assert.AreEqual(1000064, standing.FromId); Assert.AreEqual("Carthum Conglomerate", standing.FromName); Assert.AreEqual(0.34, standing.Standing); } }
public static void AccountStatusTest() { // setup mock data and parameters. var url = new Uri("https://api.eveonline.com/account/AccountStatus.xml.aspx"); Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, AccountStatusXml); // create the client to test using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { // call the method Task <EveServiceResponse <Account> > asyncTask = client.Account.AccountStatusAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue); // wait on the task asyncTask.Wait(); ApiTestHelpers.BasicSuccessResultValidations(asyncTask); EveServiceResponse <Account> result = asyncTask.Result; Assert.AreEqual(new DateTimeOffset(2011, 9, 25, 03, 57, 50, TimeSpan.Zero), result.CacheUntil); Assert.AreEqual(new DateTimeOffset(2011, 10, 20, 13, 22, 57, TimeSpan.Zero), result.ResultData.ExpiryDate); Assert.AreEqual(new DateTimeOffset(2008, 02, 09, 19, 51, 00, TimeSpan.Zero), result.ResultData.CreateDate); Assert.AreEqual(1371, result.ResultData.LogOnCount); Assert.AreEqual(TimeSpan.FromMinutes(245488), result.ResultData.LoggedInTime); } }
public static void NotificationTextsTest() { var url = new Uri("https://api.eveonline.com/char/NotificationTexts.xml.aspx"); const int characterId = 123456; long[] ids = { 1234L, 5678L }; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); data.Add(ApiConstants.Ids, string.Join(",", ids.Select(id => id.ToInvariantString()))); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\NotificationTexts.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <NotificationText> > > task = client.Character.NotificationTextsAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId, ids); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); List <NotificationText> result = task.Result.ResultData.ToList(); Assert.AreEqual(5, result.Count); Assert.IsTrue(!result[2].Text.IsNullOrWhiteSpace()); } }
public static void ContractsTest() { var url = new Uri("https://api.eveonline.com/char/Contracts.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\Contracts.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <Contract> > > task = client.Character.ContractsAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); EveServiceResponse <IEnumerable <Contract> > result = task.Result; Assert.AreEqual(38, result.ResultData.Count()); // pick one to examine Contract sample = result.ResultData.Skip(5).Take(1).First(); Assert.AreEqual(62102990, sample.ContractId); Assert.AreEqual(602995120, sample.IssuerId); Assert.AreEqual(821674710, sample.IssuserCorpId); Assert.AreEqual(ContractType.Courier, sample.Type); Assert.AreEqual(ContractStatus.Completed, sample.Status); Assert.AreEqual(new DateTimeOffset(2012, 12, 09, 20, 46, 54, TimeSpan.Zero), sample.DateIssued); } }
public static void MailingListTest() { var url = new Uri("https://api.eveonline.com/char/mailinglists.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\Mailinglists.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <MailingList> > > task = client.Character.MailingListsAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); EveServiceResponse <IEnumerable <MailingList> > result = task.Result; Assert.AreEqual(3, result.ResultData.Count()); MailingList sample = result.ResultData.Skip(1).Take(1).First(); Assert.AreEqual(128783669, sample.ListId); Assert.AreEqual("EVEMarkerScanner", sample.DisplayName); } }
public static void AllianceListTest() { var url = new Uri("https://api.eveonline.com/eve/AllianceList.xml.aspx"); var data = new Dictionary <string, string>(); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\AllianceList.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <AllianceData> > > task = client.Eve.AllianceListAsync(); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); List <AllianceData> result = task.Result.ResultData.ToList(); AllianceData rabbits = result[1]; Assert.AreEqual("The Dead Rabbits", rabbits.Name); Assert.AreEqual("TL.DR", rabbits.ShortName); Assert.AreEqual(1, rabbits.MemberCorps.Count()); } }
public static void BasicErrorParsingTest() { var url = new Uri("https://api.eveonline.com/eve/CharacterID.xml.aspx"); var names = new[] { "CCP Garthahk" }; var data = new Dictionary <string, string>(); data.Add(ApiConstants.Names, string.Join(",", names)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\GenericError.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <CharacterName> > > task = client.Eve.CharacterIdAsync(names); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); EveServiceResponse <IEnumerable <CharacterName> > result = task.Result; Assert.AreEqual(222, result.EveErrorCode); Assert.AreEqual("Key has expired. Contact key owner for access renewal.", result.EveErrorText); } }
public static void RefTypeTest() { var url = new Uri("https://api.eveonline.com/eve/RefTypes.xml.aspx"); var data = new Dictionary <string, string>(); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\RefTypes.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <RefType> > > task = client.Eve.RefTypesAsync(); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); List <RefType> result = task.Result.ResultData.ToList(); RefType rabbits = result[21]; Assert.AreEqual("Mission Completion", rabbits.Name); Assert.AreEqual(21, rabbits.Id); } }
public static void SkillTreeTest() { var url = new Uri("https://api.eveonline.com/eve/SkillTree.xml.aspx"); var data = new Dictionary <string, string>(); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\SkillTree.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <SkillGroup> > > task = client.Eve.SkillTreeAsync(); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); List <SkillGroup> result = task.Result.ResultData.ToList(); Assert.AreEqual(3, result[0].Skills.ToList()[0].Rank); Assert.AreEqual(true, result[0].Skills.ToList()[0].CannotBeTrainedOnTrial); Assert.AreEqual(3, result[0].Skills.ToList()[1].RequiredSkills.ToList()[1].Level); } }
public static void AccountBalanceTest() { // setup mock data and parameters. var url = new Uri("https://api.eveonline.com/char/AccountBalance.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, AccountBalanceXml); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <AccountBalance> > > task = client.Character.AccountBalanceAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); EveServiceResponse <IEnumerable <AccountBalance> > result = task.Result; Assert.AreEqual(new DateTimeOffset(2010, 10, 5, 21, 28, 55, TimeSpan.Zero), result.CacheUntil); Assert.AreEqual(1, result.ResultData.Count()); } }
public static void CharacterNameTestAsyncTest() { // setup mock data and parameters. var url = new Uri("https://api.eveonline.com/eve/CharacterName.xml.aspx"); var ids = new[] { 797400947L, 1188435724L }; var data = new Dictionary <string, string>(); data.Add(ApiConstants.Ids, string.Join(",", ids)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\CharacterName.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <CharacterName> > > task = client.Eve.CharacterNameAsync(ids); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); EveServiceResponse <IEnumerable <CharacterName> > result = task.Result; Assert.AreEqual(2, result.ResultData.Count()); Assert.AreEqual("CCP Prism X", result.ResultData.Skip(1).First().Name); } }
public static void CharacterNameTest() { // setup mock data and parameters. var url = new Uri("https://api.eveonline.com/eve/CharacterName.xml.aspx"); var ids = new[] { 797400947L, 1188435724L }; var data = new Dictionary <string, string>(); data.Add(ApiConstants.Ids, string.Join(",", ids)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\CharacterName.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { EveServiceResponse <IEnumerable <CharacterName> > result = client.Eve.CharacterName(ids); Assert.IsTrue(result.IsSuccessfulHttpStatus); Assert.IsFalse(result.IsFaulted); Assert.IsNull(result.ServiceException); Assert.IsFalse(result.CachedResponse); Assert.AreEqual(2, result.ResultData.Count()); Assert.AreEqual("CCP Prism X", result.ResultData.Skip(1).First().Name); } }
public static void ContactNotificationTest() { var url = new Uri("https://api.eveonline.com/char/ContactNotifications.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\ContactNotifications.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <ContactNotification> > > task = client.Character.ContactNotifications(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); EveServiceResponse <IEnumerable <ContactNotification> > result = task.Result; Assert.AreEqual(1, result.ResultData.Count()); Assert.AreEqual(308734131, result.ResultData.First().NotificationId); Assert.AreEqual(797400947, result.ResultData.First().SenderId); Assert.AreEqual("CCP Garthagk", result.ResultData.First().SenderName); Assert.AreEqual(new DateTimeOffset(2010, 05, 29, 23, 04, 00, TimeSpan.Zero), result.ResultData.First().SentDate); } }
public static void ApiKeyInfoTest() { // setup mock data and parameters. var url = new Uri("https://api.eveonline.com/account/APIKeyInfo.xml.aspx"); Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiKeyInfoXml); // create the client to test using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { // call the method Task <EveServiceResponse <ApiKeyInfo> > asyncTask = client.Account.ApiKeyInfoAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue); // wait on the task asyncTask.Wait(); ApiTestHelpers.BasicSuccessResultValidations(asyncTask); EveServiceResponse <ApiKeyInfo> result = asyncTask.Result; Assert.AreEqual(new DateTimeOffset(2011, 10, 28, 11, 19, 39, TimeSpan.Zero), result.CacheUntil); Assert.AreEqual(new DateTimeOffset(2012, 10, 13, 00, 00, 00, TimeSpan.Zero), result.ResultData.Expires); Assert.AreEqual(134217727, result.ResultData.AccessMask); Assert.AreEqual(ApiKeyType.Account, result.ResultData.ApiType); Assert.AreEqual(3, result.ResultData.Characters.Count()); Assert.IsNotNull( result.ResultData.Characters.FirstOrDefault( item => item.Name == "RTC'3" && item.CharacterId == 154432700 && item.CorporationName == "RTC'3 Corp" && item.CorporationId == 98000179)); } }
public static void MarketOrdersTest() { var url = new Uri("https://api.eveonline.com/char/MarketOrders.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\MarketOrders.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <MarketOrder> > > task = client.Character.MarketOrdersAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); EveServiceResponse <IEnumerable <MarketOrder> > result = task.Result; Assert.AreEqual(3, result.ResultData.Count()); List <MarketOrder> items = result.ResultData.ToList(); Assert.AreEqual(24, items[1].QuantityRemaining); } }
public static void ResearchTest() { var url = new Uri("https://api.eveonline.com/char/Research.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\Research.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <Research> > > task = client.Character.Research(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); List <Research> result = task.Result.ResultData.ToList(); Assert.AreEqual(4, result.Count); Assert.IsTrue(result[1].AgentId == 3011154); Assert.IsTrue(result[1].SkillTypeId == 11452); Assert.IsTrue(Equals(result[1].RemainingPoints, 33.0962187499972)); Assert.IsTrue(Equals(result[1].PointsPerDay, 65.66)); Assert.IsTrue(result[1].ResearchStartDate == new DateTimeOffset(2009, 09, 02, 06, 49, 35, TimeSpan.Zero)); } }
public static void FacWarfareTest() { var url = new Uri("https://api.eveonline.com/char/FacWarStats.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\FacWarfareData.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <FactionalWarfareStats> > task = client.Character.FactionalWarfareStatistics(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); EveServiceResponse <FactionalWarfareStats> result = task.Result; Assert.AreEqual(500001, result.ResultData.FactionId); Assert.AreEqual(12, result.ResultData.KillsTotal); } }
public static void CharacterIdTest() { var url = new Uri("https://api.eveonline.com/eve/CharacterID.xml.aspx"); var names = new[] { "CCP Garthahk" }; var data = new Dictionary <string, string>(); data.Add(ApiConstants.Names, string.Join(",", names)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\CharacterId.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <CharacterName> > > task = client.Eve.CharacterIdAsync(names); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); EveServiceResponse <IEnumerable <CharacterName> > result = task.Result; Assert.AreEqual(1, result.ResultData.Count()); Assert.AreEqual("CCP Garthagk", result.ResultData.First().Name); Assert.AreEqual(797400947, result.ResultData.First().Id); } }
public static void WalletTransactionTest() { var url = new Uri("https://api.eveonline.com/char/WalletTransactions.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data["accountKey"] = "1000"; data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\WalletTransactions.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <WalletTransaction> > > task = client.Character.WalletTransactionsAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId, 1000); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); Assert.IsNotNull(task.Result); Assert.IsNotEmpty(task.Result.ResultData); List <WalletTransaction> entries = task.Result.ResultData.ToList(); Assert.AreEqual(7, entries.Count); WalletTransaction entry = entries[6]; Assert.AreEqual(new DateTimeOffset(2010, 01, 29, 15, 45, 00, TimeSpan.Zero), entry.TransactionDateTime); Assert.AreEqual(1298649939, entry.TransactionId); Assert.AreEqual(1, entry.Quantity); Assert.AreEqual("Heavy Missile Launcher II", entry.TypeName); Assert.AreEqual(2410, entry.TypeId); Assert.AreEqual(556001.01, entry.Price); Assert.AreEqual(1703231064, entry.ClientId); Assert.AreEqual("Der Suchende", entry.ClientName); Assert.AreEqual(60004369, entry.StationId); Assert.AreEqual("Ohmahailen V - Moon 7 - Corporate Police Force Assembly Plant", entry.StationName); Assert.AreEqual("buy", entry.TransactionType); Assert.AreEqual("personal", entry.TransactionFor); } }
public static void WalletJournalTest() { var url = new Uri("https://api.eveonline.com/char/WalletJournal.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data["accountKey"] = "1000"; data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\WalletJournal.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <WalletJournalEntry> > > task = client.Character.WalletJournalAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId, 1000); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); Assert.IsNotNull(task.Result); Assert.IsNotEmpty(task.Result.ResultData); List <WalletJournalEntry> entries = task.Result.ResultData.ToList(); Assert.AreEqual(10, entries.Count); WalletJournalEntry entry = entries[8]; Assert.AreEqual(new DateTimeOffset(2008, 08, 20, 05, 19, 00, TimeSpan.Zero), entry.Date); Assert.AreEqual(1572531630, entry.RefId); Assert.AreEqual(33, entry.ReferenceType); Assert.AreEqual("anonymous", entry.FirstPartyName); Assert.AreEqual(30497503, entry.FirstPartyId); Assert.AreEqual("corpslave", entry.SecondPartyName); Assert.AreEqual(150337897, entry.SecondPartyId); Assert.IsNullOrEmpty(entry.ArgumentName); Assert.AreEqual(30497503, entry.ArgumentId); Assert.AreEqual(945000.00, entry.Amount); Assert.AreEqual(610237267.52, entry.Balance); } }
public static void CharacterSheetTest() { var url = new Uri("https://api.eveonline.com/char/CharacterSheet.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\CharacterSheet.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <CharacterData> > task = client.Character.CharacterSheetAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); EveServiceResponse <CharacterData> result = task.Result; CharacterData resultData = result.ResultData; // spot check some details. Assert.AreEqual(150337897, resultData.CharacterId); Assert.AreEqual("corpslave", resultData.Name); Assert.AreEqual(new DateTimeOffset(2006, 01, 01, 0, 0, 0, TimeSpan.Zero), resultData.BirthDate); Assert.AreEqual("Minmatar", resultData.Race); Assert.AreEqual(190210393.87, resultData.Balance); Assert.AreEqual(6, resultData.Intelligence); Assert.AreEqual(4, resultData.Memory); Assert.AreEqual(7, resultData.Charisma); Assert.AreEqual(12, resultData.Perception); Assert.AreEqual(10, resultData.Willpower); Assert.AreEqual(5, resultData.Skills.Count()); Assert.AreEqual(536500, resultData.Skills.Select(skill => skill.SkillPoints).Sum()); Assert.AreEqual(7, resultData.Certificates.Count()); Assert.AreEqual(239, resultData.Certificates.Skip(3).Take(1).First()); Assert.AreEqual(1, resultData.CorporationRoles.Count()); Assert.AreEqual(1, resultData.CorporationRolesAtHq.Count()); Assert.AreEqual(1, resultData.CorporationRolesAtOthers.Count()); Assert.AreEqual(1, resultData.CorporationRolesAtBase.Count()); } }
public static void ContactListTest() { var url = new Uri("https://api.eveonline.com/char/ContactList.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\ContactList.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <Contact> > > task = client.Character.ContactListAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); EveServiceResponse <IEnumerable <Contact> > result = task.Result; List <Contact> resultData = result.ResultData.ToList(); Assert.AreEqual(4, resultData.Count()); // personal contacts Assert.AreEqual(3010913, resultData.Take(1).First().ContactId); Assert.AreEqual("Hirento Raikkanen", resultData.Take(1).First().ContactName); Assert.AreEqual(false, resultData.Take(1).First().IsInWatchList); Assert.AreEqual(0, resultData.Take(1).First().Standing); Assert.AreEqual(797400947, resultData.Skip(1).Take(1).First().ContactId); Assert.AreEqual("CCP Garthagk", resultData.Skip(1).Take(1).First().ContactName); Assert.AreEqual(true, resultData.Skip(1).Take(1).First().IsInWatchList); Assert.AreEqual(10, resultData.Skip(1).Take(1).First().Standing); // corp contacts Assert.AreEqual(797400947, resultData[2].ContactId); Assert.AreEqual("CCP Garthagk", resultData[2].ContactName); Assert.AreEqual(false, resultData[2].IsInWatchList); // Assert.AreEqual(ContactType.CorporateContactList, resultData[2].ContactType); Assert.AreEqual(-10, resultData[2].Standing); } }
public static void UpcomingCalendarEvents() { var url = new Uri("https://api.eveonline.com/char/UpcomingCalendarEvents.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\UpcomingCalendarEvents.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <UpcomingCalendarEvent> > > task = client.Character.UpcomingCalendarEvents(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); Assert.IsNotNull(task.Result); Assert.IsNotEmpty(task.Result.ResultData); List <UpcomingCalendarEvent> events = task.Result.ResultData.ToList(); Assert.AreEqual(1, events.Count); UpcomingCalendarEvent newEvent = events[0]; Assert.AreEqual(93264, newEvent.EventId); Assert.AreEqual(1, newEvent.OwnerId); Assert.AreEqual(new DateTimeOffset(2011, 03, 26, 09, 00, 00, TimeSpan.Zero), newEvent.EventDate); Assert.AreEqual("EVE Online Fanfest 2011", newEvent.EventTitle); Assert.AreEqual(TimeSpan.Zero, newEvent.Duration); Assert.AreEqual(false, newEvent.IsImportant); Assert.AreEqual("Undecided", newEvent.Response); Assert.AreEqual( "Join us for <a href=\"http://fanfest.eveonline.com/\"> EVE Online's Fanfest 2011</a>!", newEvent.EventText); } }
public static void CharactersTest() { // setup mock data and parameters. var url = new Uri("https://api.eveonline.com/account/Characters.xml.aspx"); Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, CharactersXml); // create the client to test using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { // call the method Task <EveServiceResponse <IEnumerable <AccountCharacter> > > asyncTask = client.Account.CharactersAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue); // wait on the task asyncTask.Wait(); ApiTestHelpers.BasicSuccessResultValidations(asyncTask); EveServiceResponse <IEnumerable <AccountCharacter> > result = asyncTask.Result; Assert.AreEqual(new DateTimeOffset(2007, 12, 12, 12, 48, 50, TimeSpan.Zero), result.CacheUntil); Assert.AreEqual(3, result.ResultData.Count()); Assert.IsNotNull( result.ResultData.FirstOrDefault( item => item.Name == "Mary" && item.CharacterId == 150267069 && item.CorporationName == "Starbase Anchoring Corp" && item.CorporationId == 150279367)); Assert.IsNotNull( result.ResultData.FirstOrDefault( item => item.Name == "Marcus" && item.CharacterId == 150302299 && item.CorporationName == "Marcus Corp" && item.CorporationId == 150333466)); Assert.IsNotNull( result.ResultData.FirstOrDefault( item => item.Name == "Dieniafire" && item.CharacterId == 150340823 && item.CorporationName == "center for Advanced Studies" && item.CorporationId == 1000169)); } }
public static void ContractItemsTest() { var url = new Uri("https://api.eveonline.com/char/ContractItems.xml.aspx"); const int characterId = 123456; const int contractId = 7890; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); data.Add("contractID", contractId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\ContractItems.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <ContractItem> > > task = client.Character.ContractItemsAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId, contractId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); Assert.IsNotNull(task.Result); Assert.IsNotEmpty(task.Result.ResultData); List <ContractItem> items = task.Result.ResultData.ToList(); Assert.AreEqual(1, items.Count); ContractItem item = items[0]; Assert.AreEqual(600515136, item.RecordId); Assert.AreEqual(12067, item.TypeId); Assert.AreEqual(1, item.Quantity); Assert.AreEqual(-1, item.RawQuantity); Assert.AreEqual(false, item.IsSingleton); Assert.AreEqual(true, item.IsIncluded); } }
public static void SkillQueueTest() { var url = new Uri("https://api.eveonline.com/char/SkillQueue.xml.aspx"); const int characterId = 123456; Dictionary <string, string> data = ApiTestHelpers.GetBaseTestParams(); data.Add(ApiConstants.CharacterId, characterId.ToString(CultureInfo.InvariantCulture)); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\SkillQueue.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <QueuedSkill> > > task = client.Character.SkillQueueAsync(ApiTestHelpers.KeyIdValue, ApiTestHelpers.VCodeValue, characterId); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); Assert.IsNotNull(task.Result); Assert.IsNotEmpty(task.Result.ResultData); List <QueuedSkill> skillQueue = task.Result.ResultData.ToList(); Assert.AreEqual(2, skillQueue.Count); QueuedSkill skill = skillQueue[1]; Assert.AreEqual(2, skill.QueuePosition); Assert.AreEqual(20533, skill.TypeId); Assert.AreEqual(4, skill.Level); Assert.AreEqual(112000, skill.StartSP); Assert.AreEqual(633542, skill.EndSP); Assert.AreEqual(new DateTimeOffset(2009, 03, 18, 15, 19, 21, TimeSpan.Zero), skill.StartTime); Assert.AreEqual(new DateTimeOffset(2009, 03, 30, 03, 16, 14, TimeSpan.Zero), skill.EndTime); } }
public static void ConquerableStationListTest() { var url = new Uri("https://api.eveonline.com/eve/ConquerableStationList.xml.aspx"); var data = new Dictionary <string, string>(); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\ConquerableStations.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <IEnumerable <ConquerableStation> > > task = client.Eve.ConquerableStationListAsync(); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); List <ConquerableStation> result = task.Result.ResultData.ToList(); Assert.AreEqual(60014862, result[0].Id); } }
public static void ServerStatusTest() { var url = new Uri("https://api.eveonline.com/server/ServerStatus.xml.aspx"); var data = new Dictionary <string, string>(); IHttpRequestProvider mockProvider = MockRequests.GetMockedProvider(url, data, ApiTestHelpers.GetXmlData("TestData\\Api\\ServerStatus.xml")); using ( var client = new EveAPI(ApiTestHelpers.EveServiceApiHost, ApiTestHelpers.GetNullCacheProvider(), mockProvider)) { Task <EveServiceResponse <ServerStatus> > task = client.Server.ServerStatusAsync(); task.Wait(); ApiTestHelpers.BasicSuccessResultValidations(task); ServerStatus result = task.Result.ResultData; Assert.IsTrue(result.IsServerOpen); Assert.AreEqual(38102, result.OnlinePlayers); } }