public async Task SimpleCall()
        {
            var typeNameDict = new TypeNameDict(Logger);

            var r = await typeNameDict.GetById(new long[] { 12345 });

            Assert.AreEqual("200mm Railgun I Blueprint", r[0].Item2);

            r = await typeNameDict.GetById(new long[] { 12345, 34317 });

            Assert.AreEqual("200mm Railgun I Blueprint", r[0].Item2);
            Assert.AreEqual("Confessor", r[1].Item2);
        }
        public void Performance()
        {
            var typeNameDict = new TypeNameDict(Logger);

            var ids  = new List <long>();
            var ids2 = new List <long>();
            var dict = new Dictionary <long, string>();

            for (long i = 0; i < 400000; ++i)
            {
                ids.Add(i);
                ids2.Add(369547L);
                dict.Add(i, i.ToString());
            }

            var z = BenchmarkIt.Benchmark.This("multiple call", async() =>
            {
                await typeNameDict.GetById(ids);
            }).Against.This("multiple call", async() =>
            {
                await typeNameDict.GetById(ids);
            }).Against.This("call last", async() =>
            {
                await typeNameDict.GetById(ids2);
            })
                    .Against.This("dict call", () =>
            {
                ids.Select(x => new Tuple <long, string>(x, dict[x])).ToList();
            })
                    .Against.This("dict call2", () =>
            {
                ids2.Select(x => new Tuple <long, string>(x, dict[x])).ToList();
            })
                    .For(1).Iterations();

            z.PrintComparison();
        }
示例#3
0
        public async Task CharacterSkills()
        {
            int    code  = 4107075;
            String vcode = "R27d16Sq1v1yrO8ViWBGdhS8uFftxiUONcPMH8m9vzbaxy6NoOGIwsMpuk0Vra2N";
            var    api   = EveApi;

            var characters = api.GetCharacters(code, vcode);
            var stryju     = characters.FirstOrDefault(x => x.CharacterName == "stryju");

            Assert.IsNotNull(stryju);
            var sheet = await stryju.GetCharacterSheetAsync();

            var ids       = sheet.Result.Skills.Select(x => (long)x.TypeId).ToList();
            var typenames = (await TypeNameDict.GetById(ids)).ToDictionary
                                (key => key.Item1, value => value.Item2);

            Assert.AreEqual(ids.Count, typenames.Count);
            var uknown = typenames.Where(x => x.Value == "Unknown").ToList();

            Assert.IsTrue(typenames.ContainsValue("Logistics Cruisers"));
        }