public void MakeProgress_GivenAchievementConditionThatNeedsACountOf1_IsCompleted() { // Arrange AchievementCondition ac = new AchievementCondition("", "", 1); IAchievementCondition reportedAchievementConditionProgressChanged = null; int reportedProgressCount = 0; ac.ProgressChanged += delegate(IAchievementCondition iac, AchievementConditionProgressChangedArgs args) { reportedAchievementConditionProgressChanged = iac; reportedProgressCount = args.ProgressCount; }; IAchievementCondition reportedAchievementConditionCompleted = null; ac.ConditionCompleted += delegate(IAchievementCondition iac) { reportedAchievementConditionCompleted = iac; }; // Act ac.MakeProgress(); // Assert Assert.AreEqual(100, ac.Progress); Assert.AreEqual(1, ac.ProgressCount); Assert.AreEqual(ac, reportedAchievementConditionProgressChanged); Assert.AreEqual(1, reportedProgressCount); Assert.AreEqual(ac, reportedAchievementConditionCompleted); }
private static void AchievementProgressTest() { // create AcheivementCondition AchievementCondition achievementCondition = new AchievementCondition("acUniqueId", "acKey", 3); string uniqueId = "aUniqueId"; string atitel = "aTitel"; string adescription = "aDescription"; // create Achievement and wire event Achievement a = new Achievement(uniqueId, atitel, adescription, achievementCondition); a.ProgressChanged += AProgressChanged; // check if no progress is made yet Debug.Assert(!progress, "!progress"); // MakeProgress achievementCondition.MakeProgress(); // check if progress is made Debug.Assert(progress, "progress"); // achievementCondition has a count of 3. so making one step should raise the progress of the achievement to 33% Debug.Assert(a.Progress == 33, "a.Progress==33"); }
/// <summary> /// Checks of progression of an AchievementCondition works as designed /// </summary> private static void DoAchievementConditionProgress() { // Create AchievementCondition and wire events AchievementCondition ac = GetNewAchievementCondition(); ac.ProgressChanged += AcProgressChanged; // MakeProgress ac.MakeProgress(); Debug.Assert(ac.Progress == 20, "ac.Progress==20"); Debug.Assert(ac.ProgressCount == 1, "ac.ProgressCount==1"); // Check of progress was made Debug.Assert(madeProgress, "madeProgress"); }
/// <summary> /// Tests if the completion of an AchievementCondition works as designed /// </summary> private static void CompleteAchievementCondition() { // create the AchievementCondition and wire event AchievementCondition ac = GetNewAchievementCondition(); ac.ConditionCompleted += AcConditionCompleted; // MakeProgress ac.MakeProgress(); ac.MakeProgress(); ac.MakeProgress(); ac.MakeProgress(); // check if AchievementCondition is not completed/unlocked Debug.Assert(!completed, "!completed"); Debug.Assert(!ac.Unlocked, "!ac.Unlocked"); // make final prograss that completes/unlocks the AchievementCondition ac.MakeProgress(); // check if AchievementCondition is completed/unlocked Debug.Assert(completed, "completed"); Debug.Assert(ac.Unlocked, "ac.Unlocked"); }
/// <summary> /// Tests if the completion of an Achievement works as designed /// </summary> private static void CompleteAchievementTest() { // create AcheivementCondition AchievementCondition achievementCondition = new AchievementCondition("acUniqueId", "acKey", 1); string uniqueId = "aUniqueId"; string atitel = "aTitel"; string adescription = "aDescription"; // create Achievement and wire event Achievement a = new Achievement(uniqueId, atitel, adescription, achievementCondition); a.AchievementCompleted += AAchievementCompleted; // check if not completed yet Debug.Assert(!completed, "!completed"); // MakeProgress achievementCondition.MakeProgress(); // check if completed/unlocked Debug.Assert(completed, "completed"); Debug.Assert(a.Unlocked, "a.Unlocked"); }
private static void AchievementProgressTest() { // create AcheivementCondition AchievementCondition achievementCondition = new AchievementCondition("acUniqueId", "acKey", 3); string uniqueId = "aUniqueId"; string atitel = "aTitel"; string adescription = "aDescription"; // create Achievement and wire event Achievement a = new Achievement(uniqueId, atitel, adescription, achievementCondition); a.ProgressChanged += AProgressChanged; // check if no progress is made yet Debug.Assert(!progress, "!progress"); // MakeProgress achievementCondition.MakeProgress(); // check if progress is made Debug.Assert(progress, "progress"); // achievementCondition has a count of 3. so making one step should raise the progress of the achievement to 33% Debug.Assert(a.Progress == 33, "a.Progress==33"); }
/// <summary> /// Tests if the completion of an Achievement works as designed /// </summary> private static void CompleteAchievementTest() { // create AcheivementCondition AchievementCondition achievementCondition = new AchievementCondition("acUniqueId", "acKey", 1); string uniqueId = "aUniqueId"; string atitel = "aTitel"; string adescription = "aDescription"; // create Achievement and wire event Achievement a = new Achievement(uniqueId, atitel, adescription, achievementCondition); a.AchievementCompleted += AAchievementCompleted; // check if not completed yet Debug.Assert(!completed, "!completed"); // MakeProgress achievementCondition.MakeProgress(); // check if completed/unlocked Debug.Assert(completed, "completed"); Debug.Assert(a.Unlocked, "a.Unlocked"); }