ActivEarth.Tests.Competition.BadgeTest.TestBadgeFormattedProgress C# (CSharp) Метод

TestBadgeFormattedProgress() приватный Метод

private TestBadgeFormattedProgress ( ) : void
Результат void
        public void TestBadgeFormattedProgress()
        {
            using (_trans)
            {
                InitializeBadges();
                Log("Fetching Steps badge");
                BadgeManager.UpdateBadge(_id, Statistic.Steps);
                Badge badge = BadgeDAO.GetBadgeFromUserIdAndStatistic(_id, Statistic.Steps);

                Log("Verifying progress.");
                Assert.AreEqual(0, badge.Progress);

                Log("Updating statistic to halfway to the Bronze badge.");
                StatisticManager.SetUserStatistic(_id, Statistic.Steps, 50);
                BadgeManager.UpdateBadge(_id, Statistic.Steps);

                Log("Verifying progress.");
                Assert.AreEqual(String.Format("50 / {0}", BadgeConstants.Steps.REQUIREMENTS[BadgeLevels.Bronze].ToString("N0")),
                    BadgeManager.GetFormattedProgress(badge.ID));

                Log("Updating statistic to the Max badge.");
                StatisticManager.SetUserStatistic(_id, Statistic.Steps, BadgeConstants.Steps.REQUIREMENTS[BadgeLevels.Max]);
                BadgeManager.UpdateBadge(_id, Statistic.Steps);

                Log("Verifying progress.");
                Assert.AreEqual(String.Format("{0}", BadgeConstants.Steps.REQUIREMENTS[BadgeLevels.Max].ToString("N0")),
                    BadgeManager.GetFormattedProgress(badge.ID));

                BadgeManager.UpdateBadge(_id, Statistic.GasSavings);
                Badge gasBadge = BadgeDAO.GetBadgeFromUserIdAndStatistic(_id, Statistic.GasSavings);

                Assert.AreEqual(String.Format("$0.00 / ${0:0.00}", BadgeConstants.GasSavings.REQUIREMENTS[BadgeLevels.Bronze]),
                    BadgeManager.GetFormattedProgress(gasBadge.ID));
            }
        }