public void AddedStatCanBeFound()
        {
            // Assign
            var statsCollection = new StatsCollection(new List <IStatsProvider>()
            {
                new FakeStatsProvider()
            });

            // Act
            statsCollection.Prepare();
            statsCollection.Add("Default", new Stat(new FakeStatDefinition()
            {
                category = "Default", statName = "Agility"
            }));
            statsCollection.Add("Default2", new Stat(new FakeStatDefinition()
            {
                category = "Default", statName = "Agility"
            }));

            // Assert
            Assert.IsNotNull(statsCollection.Get("Default", "Agility"));
            Assert.IsNotNull(statsCollection.GetCategory("Default"));
            Assert.IsNotNull(statsCollection.GetCategory("Default2"));
            Assert.IsNotNull(statsCollection.Get("Default2", "Agility"));
        }
Exemple #2
0
        /// <summary>
        /// Gets the stats.
        /// </summary>
        /// <returns></returns>
        public StatsCollection GetStats()
        {
            var result = new StatsCollection();

            if (this.options.StatsFields == null || this.options.StatsFields.Count == 0)
            {
                return(result);
            }

            var profileDetails = this.trackerApi.GetProfileDetails(this.options.Platform, this.options.EpicUserName);

            if (profileDetails != null)
            {
                result.Add(profileDetails.AllStats?.GlobalSolo?.Kills?.Label, profileDetails.AllStats?.GlobalSolo?.Kills?.DisplayValue);
                result.Add(profileDetails.AllStats?.GlobalSolo?.WinRate?.Label, profileDetails.AllStats?.GlobalSolo?.WinRate?.DisplayValue);
            }

            return(result);
        }