Ejemplo n.º 1
0
 public void GetContractItems_InvalidRequest_InvalidRequestException()
 {
     EveApiResponse <ContractItems> res = validKey.Characters[0].GetContractItems(0);
     // BUG Returns http 500 on invalid id
     // TODO Add error handling
     // TODO Add valid ID test
 }
Ejemplo n.º 2
0
        public void GetKillLog()
        {
            // BUG Returns 000 OK when exhausted
            EveApiResponse <KillLog> res = validKey.Characters[0].GetKillLog();

            Assert.IsNotNull(res.Result);
        }
Ejemplo n.º 3
0
        private static async Task <IList <Transaction> > getTransactionsAsync(ApiKey key, ApiKeyEntity apiKeyEntity, int rowLimit,
                                                                              long limitId = 0)
        {
            var       transactions = new List <Transaction>();
            var       ckey         = await new CharacterKey(key.ApiKeyId, key.VCode).InitAsync().ConfigureAwait(false);
            Character entity       = ckey.Characters.Single(c => c.CharacterId == apiKeyEntity.EntityId);
            EveApiResponse <WalletTransactions> res = await entity.GetWalletTransactionsAsync(rowLimit).ConfigureAwait(false);

            while (res.Result.Transactions.Count > 0)
            {
                IOrderedEnumerable <WalletTransactions.Transaction> sortedList =
                    res.Result.Transactions.OrderByDescending(f => f.TransactionId);
                foreach (WalletTransactions.Transaction transaction in sortedList)
                {
                    if (transaction.TransactionId == limitId)
                    {
                        return(transactions);
                    }
                    var newTransaction = new Transaction();
                    newTransaction.ApiKeyEntity_Id = apiKeyEntity.Id;
                    transactions.Add(ApiEntityMapper.Map(transaction, newTransaction));
                }

                res = entity.GetWalletTransactions(rowLimit, sortedList.Last().TransactionId);
            }
            return(transactions);
        }
Ejemplo n.º 4
0
        public void GetKillLog_ValidRequest_HasResult()
        {
            EveApiResponse <KillLog> res = validKey.Corporation.GetKillLog();

            Assert.IsNotNull(res.Result);
            // TODO Test this further
        }
Ejemplo n.º 5
0
        public void GetWalletTransactions_ValidRequest_HasResult()
        {
            EveApiResponse <WalletTransactions> res = validKey.Corporation.GetWalletTransactions(50);

            Assert.IsNotNull(res.Result);
            //res = res.Result.GetOlder(50);
        }
Ejemplo n.º 6
0
        public void GetWalletJournal_ValidRequest_HasResult()
        {
            EveApiResponse <WalletJournal> res = validKey.Corporation.GetWalletJournal(1001, 5);

            Assert.IsNotNull(res.Result);
            //var older = res.Result.GetOlder(50);
        }
Ejemplo n.º 7
0
 public void GetCalendarEventAttendees_InvalidId_InvalidRequestException()
 {
     EveApiResponse <CalendarEventAttendees> res = validKey.Characters[0].GetCalendarEventAttendees(0);
     // BUG Returns http 200 and empty rowset on invalid ID
     // TODO Add valid ID test
     // TODO Add error handling
 }
        public void GetKillLog()
        {
            EveApiResponse <KillLog> xml = character.GetKillLog();

            Assert.AreEqual(63, xml.Result.Kills.First().KillId);
            Assert.AreEqual(150340823, xml.Result.Kills.First().Victim.CharacterId);
            Assert.AreEqual(1000127, xml.Result.Kills.First().Attackers.First().CorporationId);
        }
        public void GetContactList()
        {
            EveApiResponse <ContactList> xml = character.GetContactList();

            Assert.AreEqual(3010913, xml.Result.PersonalContacts.First().ContactId);
            Assert.AreEqual(797400947, xml.Result.CorporationContacts.First().ContactId);
            Assert.AreEqual(797400947, xml.Result.AllianceContacts.First().ContactId);
        }
Ejemplo n.º 10
0
        protected override void lazyLoad()
        {
            EveApiResponse <ApiKeyInfo> info = GetApiKeyInfo();

            load(info);
            Corporation = new Corporation(this, info.Result.Key.Characters.First().CorporationId,
                                          info.Result.Key.Characters.First().CorporationName);
        }
Ejemplo n.º 11
0
        protected override void lazyLoad()
        {
            EveApiResponse <ApiKeyInfo> info = GetApiKeyInfo();
            List <Character>            list =
                info.Result.Key.Characters.Select(c => new Character(this, c.CharacterId, c.CharacterName)).ToList();

            Characters = list.AsReadOnly();
            load(info);
        }
Ejemplo n.º 12
0
        public CharacterData GetCharacterData(ApiKey key, ApiKeyEntity entity)
        {
            var       data      = new CharacterData();
            var       ckey      = new CharacterKey(key.ApiKeyId, key.VCode);
            Character character = ckey.Characters.Single(c => c.CharacterId == entity.EntityId);
            EveApiResponse <CharacterInfo> info = character.GetCharacterInfo();

            return(data);
        }
Ejemplo n.º 13
0
        /// <summary>
        ///     Returns market transactions for the character.
        /// </summary>
        /// <param name="count">Optional; Used for specifying the amount of rows to return. Default is 50. Maximum is 2560.</param>
        /// <param name="fromId">Optional; Used for walking the journal backwards to get more entries.</param>
        /// <returns></returns>
        public EveApiResponse <WalletTransactions> GetWalletTransactions(int count = 1000, long fromId = 0)
        {
            const string relPath = "/char/WalletTransactions.xml.aspx";
            EveApiResponse <WalletTransactions> result = fromId == 0
                ? request <WalletTransactions>(relPath, Key, "characterId", CharacterId, "rowCount", count)
                : request <WalletTransactions>(relPath, Key, "characterId", CharacterId, "rowCount", count, "fromID",
                                               fromId);

            result.Result.CharWalker = GetWalletTransactions;
            return(result);
        }
Ejemplo n.º 14
0
        /// <summary>
        ///     Returns a list of journal transactions for the corporation.
        /// </summary>
        /// <param name="division">Optional; Wallet Division used for request. Default is Master Wallet.</param>
        /// <param name="count">Optional; Used for specifying the amount of rows to return. Default is 50. Maximum is 2560.</param>
        /// <param name="fromId">Optional; Used for walking the journal backwards to get more entries.</param>
        /// <returns></returns>
        public EveApiResponse <WalletJournal> GetWalletJournal(int division = 1000, int count = 50, long fromId = 0)
        {
            const string relPath = "/corp/WalletJournal.xml.aspx";
            EveApiResponse <WalletJournal> result = fromId == 0
                ? request <WalletJournal>(relPath, Key, "accountKey", division, "rowCount", count)
                : request <WalletJournal>(relPath, Key, "accountKey", division, "rowCount", count, "fromID", fromId);

            result.Result.CorpWalker = GetWalletJournal;
            result.Result.Division   = division;
            return(result);
        }
Ejemplo n.º 15
0
        /// <summary>
        ///     Returns a list of journal transactions for the character.
        /// </summary>
        /// <param name="count">Optional; Used for specifying the amount of rows to return. Default is 50. Maximum is 2560.</param>
        /// <param name="fromId">Optional; Used for walking the journal backwards to get more entries.</param>
        /// <returns></returns>
        public EveApiResponse <WalletJournal> GetWalletJournal(int count = 50, long fromId = 0)
        {
            // TODO add walking
            const string relPath = "/char/WalletJournal.xml.aspx";
            EveApiResponse <WalletJournal> result = fromId == 0
                ? request <WalletJournal>(relPath, Key, "characterId", CharacterId, "rowCount", count)
                : request <WalletJournal>(relPath, Key, "characterId", CharacterId, "rowCount", count, "fromID", fromId);

            result.Result.CharWalker = GetWalletJournal;
            return(result);
        }
Ejemplo n.º 16
0
        public async Task UpdateRefIdsAsync()
        {
            EveApiResponse <ReferenceTypes> reftypes = await _eveApiService.GetRefTypesAsync().ConfigureAwait(false);

            using (EveProfiteerRepository db = CreateDb()) {
                db.Context.RefTypes.RemoveRange(db.Context.RefTypes);
                foreach (ReferenceTypes.ReferenceType apireftype in reftypes.Result.RefTypes)
                {
                    RefType reftype = db.Context.RefTypes.Create();
                    ApiEntityMapper.Map(apireftype, reftype);
                    db.Context.RefTypes.Add(reftype);
                }
                await db.Context.SaveChangesAsync().ConfigureAwait(false);
            }
        }
Ejemplo n.º 17
0
 protected void load(EveApiResponse<ApiKeyInfo> info)
 {
     Contract.Requires(info != null);
     AccessMask = info.Result.Key.AccessMask;
     KeyType = (ApiKeyType) Enum.Parse(typeof (ApiKeyType), info.Result.Key.Type);
     ExpireDate = info.Result.Key.ExpireDate;
 }