Example #1
0
        public async void GetItemPriceInfo_CallGw2ApiWithInvalidIdShouldFail()
        {
            ApiHelper.InitializeClient();
            int[] fakeMatsArray = { int.MaxValue };

            await Assert.ThrowsAsync <Exception>(async() => await CommerceProcessor.getItemPriceInfo(fakeMatsArray));
        }
Example #2
0
        public async void GetItemPriceInfo_CallGw2ApiAndReturnListOfItemModels()
        {
            // Arrange
            ApiHelper.InitializeClient();
            int[] fakeMatsArray = { 19700, 19722, 30689 };


            // Act
            IList <ItemModel> itemModels = await CommerceProcessor.getItemPriceInfo(fakeMatsArray);


            // Assert
            Assert.True(itemModels.Count == 3);
            Assert.Equal(19700, itemModels[0].Id);
        }
        static async Task Main(string[] args)
        {
            ApiHelper.InitializeClient();

            // get project directory path
            string projectDirectory = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;

            // parse file containing item id and name info into dictionary
            Dictionary <int, string> parsedItemList = TextFileReader.ParseText(File.OpenRead($"{ projectDirectory }/ItemIdList.txt"));

            // strip ids from dictionairy keys to an array
            int[] mats = parsedItemList.Keys.ToArray();

            // get list of item models to parse through
            IList <ItemModel> itemModels = await CommerceProcessor.getItemPriceInfo(mats);

            ProfitHelperMethods.CalculateProfit(itemModels);
            ProfitHelperMethods.ItemProfitDisplay(itemModels, parsedItemList);
        }