public async Task GetAllAchievements_ShouldReturnCollectionOfAchievement_WhenAchievementExists()
        {
            // Arange
            var CancellationToken = new CancellationToken();
            IEnumerable <Achievement> AchievementsResult = new List <Achievement> {
                new Achievement(), new Achievement(), new Achievement()
            };

            AchievementRepoMock.Setup(x => x.GetAll(CancellationToken))
            .ReturnsAsync(AchievementsResult).Verifiable();
            UnitOfWorkMock.Setup(m => m.AchievementRepository).Returns(AchievementRepoMock.Object);

            AchievementService _AchievementService = new AchievementService(UnitOfWorkMock.Object, MapperMock.Object);

            // Act

            var Achievements = await _AchievementService.GetAllAchievements(CancellationToken);

            // Assert

            Assert.IsNotNull(Achievements);
            AchievementRepoMock.Verify();
            Assert.AreEqual(AchievementsResult, Achievements);
        }
        public void GetAllAchievements_NoArgs_AllAchievements()
        {
            var actual = m_target.GetAllAchievements();

            Assert.AreEqual(4, actual.Count);
        }
Exemplo n.º 3
0
    void OnGUI()
    {
        if (Time.time % 2 < 1)
        {
            success = callBack.GetResult();
        }

        // For Setting Up ResponseBox.
        GUI.TextArea(new Rect(10, 5, 1100, 175), success);


        //======================================= Achievement Service======================================

        if (GUI.Button(new Rect(50, 200, 200, 30), "Create Achievement"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();             // Initializing Achievement Service.
            achievementService.CreateAchievement(cons.achievementName, cons.description, callBack);
        }

        //==================================== Achievement Service=========================================

        if (GUI.Button(new Rect(260, 200, 200, 30), "Earn Achievement"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();              // Initializing Achievement Service.
            achievementService.EarnAchievement(cons.userName, cons.achievementName, cons.gameName, cons.description, callBack);
        }

        //==================================== Achievement Service========================================

        if (GUI.Button(new Rect(470, 200, 200, 30), "GetAll Achievements ForUser"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();              // Initializing Achievement Service.
            achievementService.GetAllAchievementsForUser(cons.userName, callBack);
        }

        //===================================== Achievement Service=======================================

        if (GUI.Button(new Rect(680, 200, 200, 30), "GetAll Achievements ForUserInGame"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();              // Initializing Achievement Service.
            achievementService.GetAllAchievementsForUserInGame(cons.userName, cons.gameName, callBack);
        }

        //====================================== Achievement Service======================================

        if (GUI.Button(new Rect(890, 200, 200, 30), "GetAll Achievements"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();              // Initializing Achievement Service.
            achievementService.GetAllAchievements(callBack);
        }

        //====================================== Achievement Service======================================

        if (GUI.Button(new Rect(50, 250, 200, 30), "Get Achievement ByName"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();              // Initializing Achievement Service.
            achievementService.GetAchievementByName(cons.achievementName, callBack);
        }

        //======================================= Achievement Service=====================================

        if (GUI.Button(new Rect(260, 250, 200, 30), "GetUsers Achievement"))
        {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService();              // Initializing Achievement Service.
            achievementService.GetUsersAchievement(cons.achievementName, cons.gameName, callBack);
        }
    }
Exemplo n.º 4
0
    void OnGUI()
    {
        if (Time.time % 2 < 1) {
            success = callBack.GetResult ();
        }

        // For Setting Up ResponseBox.
        GUI.TextArea (new Rect (10, 5, 1100, 175), success);

        //======================================= Achievement Service======================================

        if (GUI.Button (new Rect (50, 200, 200, 30), "Create Achievement")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService(); // Initializing Achievement Service.
            achievementService.CreateAchievement (cons.achievementName, cons.description, callBack);
        }

        //==================================== Achievement Service=========================================

        if (GUI.Button (new Rect (260, 200, 200, 30), "Earn Achievement")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.EarnAchievement (cons.userName, cons.achievementName, cons.gameName, cons.description, callBack);
        }

        //==================================== Achievement Service========================================

        if (GUI.Button (new Rect (470, 200, 200, 30), "GetAll Achievements ForUser")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetAllAchievementsForUser(cons.userName, callBack);
        }

        //===================================== Achievement Service=======================================

        if (GUI.Button (new Rect (680, 200, 200, 30), "GetAll Achievements ForUserInGame")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetAllAchievementsForUserInGame (cons.userName, cons.gameName, callBack);
        }

        //====================================== Achievement Service======================================

        if (GUI.Button (new Rect (890, 200, 200, 30), "GetAll Achievements")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetAllAchievements (callBack);
        }

        //====================================== Achievement Service======================================

        if (GUI.Button (new Rect (50, 250, 200, 30), "Get Achievement ByName")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetAchievementByName (cons.achievementName, callBack);
        }

        //======================================= Achievement Service=====================================

        if (GUI.Button (new Rect (260, 250, 200, 30), "GetUsers Achievement")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetUsersAchievement(cons.achievementName, cons.gameName, callBack);
        }
    }
Exemplo n.º 5
0
 /// <summary>
 /// Get all Achievements
 /// </summary>
 public IEnumerable <Achievement> Get()
 {
     return(m_service.GetAllAchievements());
 }