Пример #1
0
        protected override Item ParseItem(string[] itemStringLines)
        {
            ItemWithStats item = this.ParseItemWithoutStats(itemStringLines);

            item.Stats = this.ParseStats(item, itemStringLines);

            return(item);
        }
Пример #2
0
        public void ParseShouldParseType()
        {
            const string expected = "Oriath's Virtue's Eye";

            string[] itemStringLines = this.itemStringBuilder
                                       .WithType(expected)
                                       .BuildLines();

            ItemWithStats result = this.ItemParser.Parse(itemStringLines) as ItemWithStats;

            Assert.That(result.Type, Is.EqualTo(expected));
        }
Пример #3
0
        private ItemStats ParseStats(ItemWithStats item, string[] itemStringLines)
        {
            if (item is IIdentifiableItem identifiableItem && !identifiableItem.IsIdentified)
            {
                return(null);
            }

            bool shouldPreferLocalStats = item is EquippableItem equippableItem &&
                                          (equippableItem.Category == EquippableItemCategory.Armour ||
                                           equippableItem.Category == EquippableItemCategory.Weapons);

            return(this.itemStatsParser.Parse(itemStringLines, shouldPreferLocalStats));
        }
Пример #4
0
        public async Task LoadAsyncShouldCallCreateOnStatFilterViewModelFactoryForItemStats(StatCategory statCategory)
        {
            ItemWithStats      item = CreateItemWithStats(statCategory);
            SearchQueryRequest searchQueryRequest = new SearchQueryRequest {
                League = "Heist"
            };

            await this.advancedFiltersViewModel.LoadAsync(item, searchQueryRequest, default);

            foreach (var itemStat in item.Stats.AllStats)
            {
                this.statFilterViewModelFactoryMock.Verify(x => x.Create(itemStat, searchQueryRequest));
            }
        }
Пример #5
0
        public void ParseShouldCallParseOnOrganItemStatsParser()
        {
            const string expected = "Drops additional Currency Items";

            string[] itemStringLines = this.itemStringBuilder
                                       .WithType("Oriath's Virtue's Eye")
                                       .WithItemLevel(73)
                                       .WithItemStat(expected, StatCategory.Monster)
                                       .BuildLines();

            ItemWithStats result = this.ItemParser.Parse(itemStringLines) as ItemWithStats;

            this.itemStatsParserMock.Verify(x => x.Parse(itemStringLines, false));
        }
Пример #6
0
        public void ParseShouldReturnOrganItemWithStatsSetFromOrganItemStatsParser()
        {
            string[] itemStringLines = this.itemStringBuilder
                                       .WithType("Oriath's Virtue's Eye")
                                       .BuildLines();

            var expectedOrganItemStats = new ItemStats();

            this.itemStatsParserMock.Setup(x => x.Parse(It.IsAny <string[]>(), It.IsAny <bool>()))
            .Returns(expectedOrganItemStats);

            ItemWithStats result = this.ItemParser.Parse(itemStringLines) as ItemWithStats;

            Assert.That(result.Stats, Is.SameAs(expectedOrganItemStats));
        }
Пример #7
0
        public async Task LoadAsyncShouldSetStatFilterViewModels(StatCategory statCategory, GetFilterViewModels getFilterViewModelsDelegate)
        {
            ItemWithStats item      = CreateItemWithStats(statCategory);
            var           expected1 = new MinMaxStatFilterViewModel {
                Id = item.Stats.AllStats[0].Id
            };
            var expected2 = new MinMaxStatFilterViewModel {
                Id = item.Stats.AllStats[1].Id
            };

            this.statFilterViewModelFactoryMock.SetupSequence(x => x.Create(It.IsAny <ItemStat>(), It.IsAny <SearchQueryRequest>()))
            .Returns(expected1)
            .Returns(expected2);

            await this.advancedFiltersViewModel.LoadAsync(item, new SearchQueryRequest(), default);

            var filterViewModels = getFilterViewModelsDelegate(this.advancedFiltersViewModel);

            Assert.That(filterViewModels, Has.Count.EqualTo(2));

            Assert.That(filterViewModels[0], Is.EqualTo(expected1));
            Assert.That(filterViewModels[1], Is.EqualTo(expected2));
        }