コード例 #1
0
        void Start()
        {
            mPM = new AllRewardsPM(SingleRewardsSpawner, Messenger, DungeonManager.Rewards);

            SetModel(mPM.ViewModel);
            CreateSingleRewardViews();
        }
コード例 #2
0
        public void WhenCreating_CoveredRewardCount_EqualsIncomingRewardCount()
        {
            List <IDungeonReward> mockRewards     = GetMockRewards(3);
            AllRewardsPM          systemUnderTest = new AllRewardsPM(Substitute.For <ISingleRewardPM_Spawner>(), Substitute.For <IMessageService>(), mockRewards);

            Assert.AreEqual(mockRewards.Count, systemUnderTest.CoveredRewardCount);
        }
コード例 #3
0
        public void WhenCreating_SingleRewardPMs_AreCreatedFromIncomingData()
        {
            List <IDungeonReward> mockRewards     = GetMockRewards(3);
            AllRewardsPM          systemUnderTest = new AllRewardsPM(Substitute.For <ISingleRewardPM_Spawner>(), Substitute.For <IMessageService>(), mockRewards);

            Assert.AreEqual(3, systemUnderTest.SingleRewardPMs.Count);
        }
コード例 #4
0
        public void WhenCreating_ExpectedMessagesSubscribed()
        {
            IMessageService mockMessenger   = Substitute.For <IMessageService>();
            AllRewardsPM    systemUnderTest = new AllRewardsPM(Substitute.For <ISingleRewardPM_Spawner>(), mockMessenger, new List <IDungeonReward>());

            mockMessenger.Received().AddListener(GameMessages.GAME_OVER, Arg.Any <Callback <bool> >());
        }
コード例 #5
0
        public void WhenUncoveringReward_IfCoveredCountIsZero_CanContinueIsTrue()
        {
            List <IDungeonReward> mockRewards     = GetMockRewards(1);
            AllRewardsPM          systemUnderTest = new AllRewardsPM(Substitute.For <ISingleRewardPM_Spawner>(), Substitute.For <IMessageService>(), mockRewards);

            systemUnderTest.RewardUncovered();

            Assert.IsTrue(systemUnderTest.ViewModel.GetPropertyValue <bool>(AllRewardsPM.CAN_CONTINUE_PROPERTY));
        }
コード例 #6
0
        public void WhenUncoveringReward_CoveredCountDecreases()
        {
            List <IDungeonReward> mockRewards     = GetMockRewards(3);
            AllRewardsPM          systemUnderTest = new AllRewardsPM(Substitute.For <ISingleRewardPM_Spawner>(), Substitute.For <IMessageService>(), mockRewards);

            systemUnderTest.RewardUncovered();

            Assert.AreEqual(mockRewards.Count - 1, systemUnderTest.CoveredRewardCount);
        }
コード例 #7
0
        public void WhenPlayerWins_IsVisible_IsTrue()
        {
            AllRewardsPM systemUnderTest = new AllRewardsPM(Substitute.For <ISingleRewardPM_Spawner>(), Substitute.For <IMessageService>(), new List <IDungeonReward>());

            systemUnderTest.ViewModel.SetProperty(AllRewardsPM.VISIBLE_PROPERTY, false);

            systemUnderTest.OnGameOver(true);

            Assert.IsTrue(systemUnderTest.ViewModel.GetPropertyValue <bool>(AllRewardsPM.VISIBLE_PROPERTY));
        }
コード例 #8
0
        public void WhenCreating_Visibility_IsFalse()
        {
            AllRewardsPM systemUnderTest = new AllRewardsPM(Substitute.For <ISingleRewardPM_Spawner>(), Substitute.For <IMessageService>(), new List <IDungeonReward>());

            Assert.IsFalse(systemUnderTest.ViewModel.GetPropertyValue <bool>(AllRewardsPM.VISIBLE_PROPERTY));
        }