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);
        }
示例#2
0
        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");
        }
        public MainWindow()
        {
            InitializeComponent();

            AchievementManager achievementManager = AchievementManager.GetInstance();

            AchievementCondition clickConditionOne = new AchievementCondition("ClickedOne", "Click1", 3);
            Achievement          a1 = new Achievement("a1", "Clicked ONE", "You clicked on ONE", clickConditionOne, "/sebingel.sharpchievements;component/Images/award71.png");

            AchievementCondition clickConditionTwo = new AchievementCondition("ClickedTwo", "Click2", 1);
            Achievement          a2 = new Achievement("a2", "Clicked TWO", "You clicked on TWO", clickConditionTwo);

            AchievementCondition clickConditionThree = new AchievementCondition("ClickedThree", "Click3", 1);
            Achievement          a3 = new Achievement("a3", "Clicked THREE", "You clicked on THREE", clickConditionThree);

            AchievementCondition clickConditionFour = new AchievementCondition("SpecialOne", "Click1", 1);
            AchievementCondition clickConditionFive = new AchievementCondition("SpecialTwo", "Click2", 3);
            Achievement          a4 = new Achievement("a4", "SPECIAL!!!", "You clicked on ONE", new List <AchievementCondition> {
                clickConditionFour, clickConditionFive
            });

            achievementManager.RegisterAchievement(a1);
            achievementManager.RegisterAchievement(a2);
            achievementManager.RegisterAchievement(a3);
            achievementManager.RegisterAchievement(a4);

            achievementManager.RegisterAchievementCondition(clickConditionOne);
            achievementManager.RegisterAchievementCondition(clickConditionTwo);
            achievementManager.RegisterAchievementCondition(clickConditionThree);
            achievementManager.RegisterAchievementCondition(clickConditionFour);
            achievementManager.RegisterAchievementCondition(clickConditionFive);

            achievementManager.AchievementCompleted += AchievementManagerAchievementCompleted;
        }
示例#4
0
        public static void serialize(AchievementCondition value, XSteam steam)
        {
            // null
            boolBuffer.serialize(value == null, steam);
            if (value == null)
            {
                return;
            }

            // type

            intBuffer.serialize(value.type, steam);



            // count

            intBuffer.serialize(value.count, steam);



            // param

            intBuffer.serialize(value.param, steam);



            // compareType

            intBuffer.serialize(value.compareType, steam);
        }
        private static void CheckAchievementUnlockStatusTest()
        {
            AchievementManager am = new AchievementManager();

            // Create a new AchievementCondition with an obnoxiously long name to minimize the chance of having a duplicate
            AchievementCondition checkAchievementUnlockStatusTestAchievementCondition =
                new AchievementCondition("checkAchievementUnlockStatusTestAchievementCondition",
                    "checkAchievementUnlockStatusTestAchievementCondition", 1);

            // Register the AchievementCondition with the obnoxiously long name
            am.RegisterAchievementCondition(checkAchievementUnlockStatusTestAchievementCondition);

            // Report Progress and unlock the AchievementCondition with the obnoxiously long name
            am.ReportProgress("checkAchievementUnlockStatusTestAchievementCondition");

            // After completing the AchievementCondition with the obnoxiously long name add it to a new Achievement with an obnoxiously long name (to minimize the chance of having a duplicate, you know?)
            Achievement checkAchievementUnlockStatusTestAchievement =
                new Achievement("CheckAchievementUnlockStatusTestAchievement",
                    "Achievement with an obnoxiously long name", "DUMMY",
                    checkAchievementUnlockStatusTestAchievementCondition);

            // The new Achievement is still locked
            Debug.Assert(!checkAchievementUnlockStatusTestAchievement.Unlocked, "!CheckAchievementUnlockStatusTestAchievement.Unlocked");

            // ReEvaluate Lock-Status
            checkAchievementUnlockStatusTestAchievement.CheckUnlockStatus();

            // The Achievement should now be unlocked
            Debug.Assert(checkAchievementUnlockStatusTestAchievement.Unlocked, "CheckAchievementUnlockStatusTestAchievement.Unlocked");
        }
示例#6
0
        private static void CheckAchievementUnlockStatusTest()
        {
            AchievementManager am = new AchievementManager();

            // Create a new AchievementCondition with an obnoxiously long name to minimize the chance of having a duplicate
            AchievementCondition checkAchievementUnlockStatusTestAchievementCondition =
                new AchievementCondition("checkAchievementUnlockStatusTestAchievementCondition",
                                         "checkAchievementUnlockStatusTestAchievementCondition", 1);

            // Register the AchievementCondition with the obnoxiously long name
            am.RegisterAchievementCondition(checkAchievementUnlockStatusTestAchievementCondition);

            // Report Progress and unlock the AchievementCondition with the obnoxiously long name
            am.ReportProgress("checkAchievementUnlockStatusTestAchievementCondition");

            // After completing the AchievementCondition with the obnoxiously long name add it to a new Achievement with an obnoxiously long name (to minimize the chance of having a duplicate, you know?)
            Achievement checkAchievementUnlockStatusTestAchievement =
                new Achievement("CheckAchievementUnlockStatusTestAchievement",
                                "Achievement with an obnoxiously long name", "DUMMY",
                                checkAchievementUnlockStatusTestAchievementCondition);

            // The new Achievement is still locked
            Debug.Assert(!checkAchievementUnlockStatusTestAchievement.Unlocked, "!CheckAchievementUnlockStatusTestAchievement.Unlocked");

            // ReEvaluate Lock-Status
            checkAchievementUnlockStatusTestAchievement.CheckUnlockStatus();

            // The Achievement should now be unlocked
            Debug.Assert(checkAchievementUnlockStatusTestAchievement.Unlocked, "CheckAchievementUnlockStatusTestAchievement.Unlocked");
        }
 public static AchievementCondition[] CreateMany(params short[] npcs)
 {
     AchievementCondition[] nPCKilledCondition = new AchievementCondition[(int)npcs.Length];
     for (int i = 0; i < (int)npcs.Length; i++)
     {
         nPCKilledCondition[i] = new NPCKilledCondition(npcs[i]);
     }
     return(nPCKilledCondition);
 }
示例#8
0
 public static AchievementCondition[] CreateMany(params short[] npcs)
 {
     AchievementCondition[] array = new AchievementCondition[npcs.Length];
     for (int i = 0; i < npcs.Length; i++)
     {
         array[i] = new NPCKilledCondition(npcs[i]);
     }
     return(array);
 }
示例#9
0
        /// <summary>
        /// Creates an AchievementCondition
        /// </summary>
        private static void CreateAchievementCondition()
        {
            AchievementCondition ac = GetNewAchievementCondition();

            Debug.Assert(ac.UniqueId == uniqueId, "ac.UniqueId==uniqueId");
            Debug.Assert(ac.Unlocked == false, "ac.Unlocked==false");
            Debug.Assert(ac.AchievementConditionKey == achievementConditionKey, "ac.AchievementConditionKey==achievementConditionKey");
            Debug.Assert(ac.CountToUnlock == 5, "ac.CountToUnlock==5");
        }
示例#10
0
 public static AchievementCondition[] CreateMany(params short[] npcs)
 {
     AchievementCondition[] achievementConditionArray = new AchievementCondition[npcs.Length];
     for (int index = 0; index < npcs.Length; ++index)
     {
         achievementConditionArray[index] = (AchievementCondition) new NPCKilledCondition(npcs[index]);
     }
     return(achievementConditionArray);
 }
 public static AchievementCondition[] CreateMany(params short[] items)
 {
     AchievementCondition[] itemCraftCondition = new AchievementCondition[(int)items.Length];
     for (int i = 0; i < (int)items.Length; i++)
     {
         itemCraftCondition[i] = new ItemCraftCondition(items[i]);
     }
     return(itemCraftCondition);
 }
示例#12
0
 public static AchievementCondition[] CreateMany(params short[] items)
 {
     AchievementCondition[] achievementConditionArray = new AchievementCondition[items.Length];
     for (int index = 0; index < items.Length; ++index)
     {
         achievementConditionArray[index] = (AchievementCondition) new ItemPickupCondition(items[index]);
     }
     return(achievementConditionArray);
 }
 public static AchievementCondition[] CreateMany(params short[] items)
 {
     AchievementCondition[] array = new AchievementCondition[items.Length];
     for (int i = 0; i < items.Length; i++)
     {
         array[i] = new ItemPickupCondition(items[i]);
     }
     return(array);
 }
示例#14
0
        public static AchievementCondition[] CreateMany(params short[] items)
        {
            var achievementConditionArray = new AchievementCondition[items.Length];

            for (var index = 0; index < items.Length; ++index)
            {
                achievementConditionArray[index] = new ItemCraftCondition(items[index]);
            }
            return(achievementConditionArray);
        }
示例#15
0
        public IActionResult GetByPage(int pi, int ps, AchievementCondition condition = null)
        {
            var result = _achievementService.GetByPage(pi, ps, null, condition);

            return(Ok(new
            {
                Total = result.Total,
                List = Mapper.Map <List <AchievementDto> >(result.Data)
            }));
        }
        public void Constructor_CreateInstance_CanCreateInstance()
        {
            // Arrange
            AchievementCondition ac;

            // Act
            ac = new AchievementCondition("", "", 0);

            // Assert
            Assert.IsNotNull(ac);
        }
示例#17
0
        public MainWindow()
        {
            InitializeComponent();

            am = new AchievementManager();

            AchievementCondition con1 = new AchievementCondition("con1", "con1", 1);
            AchievementCondition con2 = new AchievementCondition("con2", "con2", 2);
            AchievementCondition con3 = new AchievementCondition("con3", "con3", 1);
            Achievement          a1   = new Achievement("a1", "a1", "a1Desc", con1)
            {
                ImagePath = "/sebingel.sharpchievements;component/Images/award71.png"
            };
            Achievement a2 = new Achievement("a2", "a2", "a2Desc\nWrap", con2)
            {
                ImagePath = "/sebingel.sharpchievements;component/Images/award71.png"
            };
            Achievement a3 = new Achievement("a3", "a3", "a2Desc\nWrap", con3)
            {
                ImagePath = "/sebingel.sharpchievements;component/Images/award71.png", Hidden = true
            };

            //Achievement a4 = new Achievement("a4", "a4", "a2Desc\nWrap", con1, "/sebingel.sharpchievements;component/Images/question30.png");
            //Achievement a5 = new Achievement("a5", "a5", "a2Desc\nWrap", con1, "/sebingel.sharpchievements;component/Images/award71.png");
            //Achievement a6 = new Achievement("a6", "a6", "a2Desc\nWrap", con1, "/sebingel.sharpchievements;component/Images/award71.png");
            //Achievement a7 = new Achievement("a7", "a7", "a2Desc\nWrap", con1, "/sebingel.sharpchievements;component/Images/award71.png");
            //Achievement a8 = new Achievement("a8", "a8", "a2Desc\nWrap", con1, "/sebingel.sharpchievements;component/Images/award71.png");
            //Achievement a9 = new Achievement("a9", "a9", "a2Desc\nWrap", con1, "/sebingel.sharpchievements;component/Images/award71.png");
            //Achievement a10 = new Achievement("a10", "a10", "a2Desc\nWrap", con1, "/sebingel.sharpchievements;component/Images/award71.png");
            //Achievement a11 = new Achievement("a11", "a11", "a2Desc\nWrap", con1, "/sebingel.sharpchievements;component/Images/award71.png");

            am.RegisterAchievementCondition(con1);
            am.RegisterAchievementCondition(con2);
            am.RegisterAchievementCondition(con3);
            am.RegisterAchievement(a1);
            am.RegisterAchievement(a2);
            am.RegisterAchievement(a3);
            //am.RegisterAchievement(a4);
            //am.RegisterAchievement(a5);
            //am.RegisterAchievement(a6);
            //am.RegisterAchievement(a7);
            //am.RegisterAchievement(a8);
            //am.RegisterAchievement(a9);
            //am.RegisterAchievement(a10);
            //am.RegisterAchievement(a11);

            am.AchievementCompleted += AmAchievementCompleted;

            AchievementOverviewControl.Refresh();
        }
示例#18
0
        /// <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");
        }
示例#19
0
        /// <summary>
        /// Checks the Constructors of Achievement
        /// </summary>
        private static void CreateAchievementTest()
        {
            // Create AchievementCondition
            AchievementCondition achievementCondition = new AchievementCondition("acUniqueId", "acKey", 5);
            string uniqueId     = "aUniqueId";
            string atitel       = "aTitel";
            string adescription = "aDescription";
            string aImagepath   = "aImagepath";

            #region Constructor 1

            Achievement a = new Achievement(uniqueId, atitel, adescription, achievementCondition);
            Debug.Assert(!a.Unlocked, "!a.Unlocked");
            Debug.Assert(a.Conditions.ToList()[0] == achievementCondition, "a.Conditions[0]==achievementCondition");
            Debug.Assert(a.Description == adescription, "a.Description==adescription");
            Debug.Assert(String.IsNullOrEmpty(a.ImagePath), "String.IsNullOrEmpty(a.ImagePath)");
            Debug.Assert(a.Progress == 0, "a.Progress==0");
            Debug.Assert(a.Titel == atitel, "a.Titel==atitel");
            Debug.Assert(a.UniqueId == uniqueId, "a.UniqueId == uniqueId");
            Debug.Assert(a.Conditions.Any(), "a.Conditions.Count == 1");
            Debug.Assert(!a.Hidden, "!a.Hidden");

            #endregion

            #region Constructor 2

            a = new Achievement(uniqueId, atitel, adescription, new List <AchievementCondition> {
                achievementCondition
            });
            Debug.Assert(!a.Unlocked, "!a.Unlocked");
            Debug.Assert(a.Conditions.ToList()[0] == achievementCondition, "a.Conditions[0]==achievementCondition");
            Debug.Assert(a.Description == adescription, "a.Description==adescription");
            Debug.Assert(String.IsNullOrEmpty(a.ImagePath), "String.IsNullOrEmpty(a.ImagePath)");
            Debug.Assert(a.Progress == 0, "a.Progress==0");
            Debug.Assert(a.Titel == atitel, "a.Titel==atitel");
            Debug.Assert(a.UniqueId == uniqueId, "a.UniqueId == uniqueId");
            Debug.Assert(a.Conditions.Any(), "a.Conditions.Count == 1");
            Debug.Assert(!a.Hidden, "!a.Hidden");

            #endregion

            a.ImagePath = aImagepath;
            a.Hidden    = true;

            Debug.Assert(a.ImagePath == aImagepath, "a.ImagePath == aImagepath");
            Debug.Assert(a.Hidden, "a.Hidden");
        }
示例#20
0
        public static AchievementCondition deserialize(byte[] buffer, ref uint offset)
        {
            // null
            bool _null = boolBuffer.deserialize(buffer, ref offset);

            if (_null)
            {
                return(null);
            }

            // type

            int _type = intBuffer.deserialize(buffer, ref offset);



            // count

            int _count = intBuffer.deserialize(buffer, ref offset);



            // param

            int _param = intBuffer.deserialize(buffer, ref offset);



            // compareType

            int _compareType = intBuffer.deserialize(buffer, ref offset);

            AchievementCondition _AchievementCondition = new AchievementCondition();

            _AchievementCondition.type = _type;

            _AchievementCondition.count = _count;

            _AchievementCondition.param = _param;

            _AchievementCondition.compareType = _compareType;
            return(_AchievementCondition);
        }
示例#21
0
        /// <summary>
        /// Checks if clearing of an Achievement works as designed
        /// </summary>
        private static void ClearAchievementTest()
        {
            // create AchievementConditions
            AchievementCondition achievementCondition  = new AchievementCondition("acUniqueId", "acKey", 5);
            AchievementCondition achievementCondition2 = new AchievementCondition("acUniqueId2", "acKey", 5);
            string uniqueId     = "aUniqueId";
            string atitel       = "aTitel";
            string adescription = "aDescription";

            // create Achievement
            Achievement a = new Achievement(uniqueId, atitel, adescription, new List <AchievementCondition> {
                achievementCondition, achievementCondition2
            });

            // check of Achievement has both AchievementConditions
            Debug.Assert(a.Conditions.Count() == 2, "a.Conditions.Count == 2");

            // clear Achievement
            a.Clear();
            // Check if Conditions are gone
            Debug.Assert(!a.Conditions.Any(), "!a.Conditions.Any()");
        }
示例#22
0
        /// <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");
        }
示例#23
0
        /// <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");
        }
        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");
        }
示例#25
0
        /// <summary>
        ///     分页方法
        /// </summary>
        /// <param name="page"></param>
        /// <param name="size"></param>
        /// <param name="sort"></param>
        /// <param name="condition"></param>
        /// <returns></returns>
        public PageModel <Achievement> GetByPage(int page, int size, string sort, AchievementCondition condition)
        {
            var dbCondition = new List <DbCondition <Achievement> >();

            return(_unitOfWork.AchievementManage.GetByPage(page, size, sort, dbCondition));
        }
示例#26
0
        public static AchievementConfig deserialize(byte[] buffer, ref uint offset)
        {
            // null
            bool _null = boolBuffer.deserialize(buffer, ref offset);

            if (_null)
            {
                return(null);
            }

            // Id

            int _Id = intBuffer.deserialize(buffer, ref offset);



            // Name

            int _Name = intBuffer.deserialize(buffer, ref offset);



            // Desc

            int _Desc = intBuffer.deserialize(buffer, ref offset);



            // Icon

            int _Icon = intBuffer.deserialize(buffer, ref offset);



            // Difficulty

            int _Difficulty = intBuffer.deserialize(buffer, ref offset);



            // Condition

            AchievementCondition _Condition = AchievementConditionBuffer.deserialize(buffer, ref offset);



            // RewardItem


            int _RewardItem_length = intBuffer.deserialize(buffer, ref offset);

            RewardItem[] _RewardItem = new RewardItem[_RewardItem_length];
            for (int i = 0; i < _RewardItem_length; i++)
            {
                _RewardItem[i] = RewardItemBuffer.deserialize(buffer, ref offset);
            }


            // Buff

            IdPair _Buff = IdPairBuffer.deserialize(buffer, ref offset);



            // NeedAchievement

            int _NeedAchievement = intBuffer.deserialize(buffer, ref offset);



            // TargetSystem

            TargetSystem _TargetSystem = TargetSystemBuffer.deserialize(buffer, ref offset);



            // Group

            int _Group = intBuffer.deserialize(buffer, ref offset);

            AchievementConfig _AchievementConfig = new AchievementConfig();

            _AchievementConfig.Id = _Id;

            _AchievementConfig.Name = _Name;

            _AchievementConfig.Desc = _Desc;

            _AchievementConfig.Icon = _Icon;

            _AchievementConfig.Difficulty = _Difficulty;

            _AchievementConfig.Condition = _Condition;

            _AchievementConfig.RewardItem = _RewardItem;

            _AchievementConfig.Buff = _Buff;

            _AchievementConfig.NeedAchievement = _NeedAchievement;

            _AchievementConfig.TargetSystem = _TargetSystem;

            _AchievementConfig.Group = _Group;
            return(_AchievementConfig);
        }
        /// <summary>
        /// Executes the Test
        /// </summary>
        internal static void Execute()
        {
            // ---- ATTENTION ----
            // Since AchievementManager is a Singleton testing is a bit tricky.
            // We can not just create a new instance for each test so we have to test everything in regard
            // of the current state of AchievementManager

            // path for the test of the Save() and Load() methods
            string saveFilePath = "./achievementSaveTest.bin";

            // clear possible remains
            if (File.Exists(saveFilePath))
            {
                File.Delete(saveFilePath);
            }

            AchievementManager am = new AchievementManager();

            am.AchievementCompleted  += AmAchievementCompleted;
            am.AchievementRegistered += AmAchievementRegistered;

            // create and register first Achievement/AchievementCondition
            AchievementCondition achievementCondition1 = new AchievementCondition("aCUniqueId1", "aCConditionKey1", 1);
            Achievement          achievement1          = new Achievement("aUniqueId1", "aTitel", "aDescription", achievementCondition1);

            am.RegisterAchievementCondition(achievementCondition1);
            am.RegisterAchievement(achievement1);

            Debug.Assert(registered, "registered");

            // Check if first Achievement is in place
            Debug.Assert(am.AchievementList.Count == 1, "am.AchievementList().Count == 1");
            Debug.Assert(am.AchievementList.Contains(achievement1), "am.AchievementList().Contains(achievement1)");

            // create and register second Achievement/AchievementCondition
            AchievementCondition achievementCondition5 = new AchievementCondition("aCUniqueId5", "aCConditionKey5", 5);
            Achievement          achievement5          = new Achievement("aUniqueId2", "aTitel", "aDescription", achievementCondition5);

            am.RegisterAchievementCondition(achievementCondition5);
            am.RegisterAchievement(achievement5);

            // check if second Achievement is in place
            Debug.Assert(am.AchievementList.Count == 2, "am.AchievementList().Count == 2");
            Debug.Assert(am.AchievementList.Contains(achievement5), "am.AchievementList().Contains(achievement5)");

            // check progression
            Debug.Assert(completed == null, "completed==null");
            am.ReportProgress("aCConditionKey1");
            Debug.Assert(completed == achievement1, "completed==achievement1");
            Debug.Assert(achievement1.Unlocked, "achievement1.Unlocked");

            // check deletion
            am.DeleteAchievementByUniqueId("aUniqueId1");
            Debug.Assert(am.AchievementList.Count == 1, "am.AchievementList().Count==1");
            Debug.Assert(!am.AchievementList.Contains(achievement1));

            // check progression again
            am.ReportProgress("aCConditionKey5");
            am.ReportProgress("aCConditionKey5");
            am.ReportProgress("aCConditionKey5");
            am.ReportProgress("aCConditionKey5");
            am.ReportProgress("aCConditionKey5");
            Debug.Assert(completed == achievement5, "completed==achievement5");
            Debug.Assert(achievement5.Unlocked, "achievement5.Unlocked");

            // check saving
            am.SaveAchiements(saveFilePath);
            Debug.Assert(File.Exists(saveFilePath), "File.Exists('achievementSaveTest.bin')");

            // check resetting
            am.Reset();
            Debug.Assert(am.AchievementList.Count == 0, "am.AchievementList().Count==0");

            // check loading
            am.LoadAchievements(saveFilePath, true);
            Debug.Assert(am.AchievementList.Count == 1, "am.AchievementList().Count==1");
            Debug.Assert(am.AchievementList[0].Unlocked, "am.AchievementList()[0].Unlocked");

            // clear remains
            File.Delete(saveFilePath);

            // Add new Achievements with old and unlocked AchievementConditions
            Achievement achievement = new Achievement("anotherObnoxiouslyLongUniqueIdToEnsureWeHaveNoDuplicates", "Name", "DUMMY", achievementCondition1);

            am.RegisterAchievement(achievement);
            Achievement achievement2 = new Achievement("anotherObnoxiouslyLongUniqueIdToEnsureWeHaveNoDuplicates2", "Name", "DUMMY", achievementCondition5);

            am.RegisterAchievement(achievement2);
            Achievement achievement3 = new Achievement("anotherObnoxiouslyLongUniqueIdToEnsureWeHaveNoDuplicates3", "Name", "DUMMY", new List <AchievementCondition> {
                achievementCondition1, achievementCondition5
            });

            am.RegisterAchievement(achievement3);

            Debug.Assert(!achievement.Unlocked, "!achievement.Unlocked");
            Debug.Assert(!achievement2.Unlocked, "!achievement2.Unlocked");
            Debug.Assert(!achievement3.Unlocked, "!achievement3.Unlocked");

            am.ReevaluateUnlockStatus();

            Debug.Assert(achievement.Unlocked, "achievement.Unlocked");
            Debug.Assert(achievement2.Unlocked, "achievement2.Unlocked");
            Debug.Assert(achievement3.Unlocked, "achievement3.Unlocked");
        }
        /// <summary>
        /// Checks the Constructors of Achievement
        /// </summary>
        private static void CreateAchievementTest()
        {
            // Create AchievementCondition
            AchievementCondition achievementCondition = new AchievementCondition("acUniqueId", "acKey", 5);
            string uniqueId = "aUniqueId";
            string atitel = "aTitel";
            string adescription = "aDescription";
            string aImagepath = "aImagepath";

            #region Constructor 1

            Achievement a = new Achievement(uniqueId, atitel, adescription, achievementCondition);
            Debug.Assert(!a.Unlocked, "!a.Unlocked");
            Debug.Assert(a.Conditions.ToList()[0] == achievementCondition, "a.Conditions[0]==achievementCondition");
            Debug.Assert(a.Description == adescription, "a.Description==adescription");
            Debug.Assert(String.IsNullOrEmpty(a.ImagePath), "String.IsNullOrEmpty(a.ImagePath)");
            Debug.Assert(a.Progress == 0, "a.Progress==0");
            Debug.Assert(a.Titel == atitel, "a.Titel==atitel");
            Debug.Assert(a.UniqueId == uniqueId, "a.UniqueId == uniqueId");
            Debug.Assert(a.Conditions.Any(), "a.Conditions.Count == 1");
            Debug.Assert(!a.Hidden, "!a.Hidden");

            #endregion

            #region Constructor 2

            a = new Achievement(uniqueId, atitel, adescription, new List<AchievementCondition> { achievementCondition });
            Debug.Assert(!a.Unlocked, "!a.Unlocked");
            Debug.Assert(a.Conditions.ToList()[0] == achievementCondition, "a.Conditions[0]==achievementCondition");
            Debug.Assert(a.Description == adescription, "a.Description==adescription");
            Debug.Assert(String.IsNullOrEmpty(a.ImagePath), "String.IsNullOrEmpty(a.ImagePath)");
            Debug.Assert(a.Progress == 0, "a.Progress==0");
            Debug.Assert(a.Titel == atitel, "a.Titel==atitel");
            Debug.Assert(a.UniqueId == uniqueId, "a.UniqueId == uniqueId");
            Debug.Assert(a.Conditions.Any(), "a.Conditions.Count == 1");
            Debug.Assert(!a.Hidden, "!a.Hidden");

            #endregion

            a.ImagePath = aImagepath;
            a.Hidden = true;

            Debug.Assert(a.ImagePath == aImagepath, "a.ImagePath == aImagepath");
            Debug.Assert(a.Hidden, "a.Hidden");
        }
        /// <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");
        }
        /// <summary>
        /// Checks if clearing of an Achievement works as designed
        /// </summary>
        private static void ClearAchievementTest()
        {
            // create AchievementConditions
            AchievementCondition achievementCondition = new AchievementCondition("acUniqueId", "acKey", 5);
            AchievementCondition achievementCondition2 = new AchievementCondition("acUniqueId2", "acKey", 5);
            string uniqueId = "aUniqueId";
            string atitel = "aTitel";
            string adescription = "aDescription";

            // create Achievement
            Achievement a = new Achievement(uniqueId, atitel, adescription, new List<AchievementCondition> { achievementCondition, achievementCondition2 });
            // check of Achievement has both AchievementConditions
            Debug.Assert(a.Conditions.Count() == 2, "a.Conditions.Count == 2");

            // clear Achievement
            a.Clear();
            // Check if Conditions are gone
            Debug.Assert(!a.Conditions.Any(), "!a.Conditions.Any()");
        }