Ejemplo n.º 1
0
        public void WhenAwarded_CollectCountIsIncremented()
        {
            SingleLoginPromoProgressSaveData systemUnderTest = new SingleLoginPromoProgressSaveData();

            systemUnderTest.CollectCount = 1;

            systemUnderTest.OnAwarded(1000);

            Assert.AreEqual(2, systemUnderTest.GetCollectCount());
        }
Ejemplo n.º 2
0
        public void WhenAwarded_CollectTimeIsSet()
        {
            SingleLoginPromoProgressSaveData systemUnderTest = new SingleLoginPromoProgressSaveData();

            systemUnderTest.LastCollectedTime = 0;

            systemUnderTest.OnAwarded(1000);

            Assert.AreEqual(1000, systemUnderTest.GetLastCollectedTime());
        }
Ejemplo n.º 3
0
        public void WhenPromoDataIsNull_AreRewardsRemaining_ReturnsFalse()
        {
            SingleLoginPromoProgressSaveData systemUnderTest = new SingleLoginPromoProgressSaveData();

            systemUnderTest.CollectCount = 1;

            bool areRewardsRemaining = systemUnderTest.AreRewardsRemaining(null);

            Assert.IsFalse(areRewardsRemaining);
        }
Ejemplo n.º 4
0
        public void AreRewardsRemaining_ReturnsAsExpected(int i_rewardsCollected, int i_totalRewards, bool i_expectedResult)
        {
            SingleLoginPromoProgressSaveData systemUnderTest = new SingleLoginPromoProgressSaveData();

            systemUnderTest.CollectCount = i_rewardsCollected;

            ILoginPromotionData mockData = Substitute.For <ILoginPromotionData>();

            mockData.GetRewardsCount().Returns(i_totalRewards);
            bool areRewardsRemaining = systemUnderTest.AreRewardsRemaining(mockData);

            Assert.AreEqual(i_expectedResult, areRewardsRemaining);
        }
Ejemplo n.º 5
0
        public void IsNoChain_ReturnsAsExpected(DateTime i_curTime, DateTime i_lastCollectedTime, bool i_expected)
        {
            IBackendManager mockBackendManager = Substitute.For <IBackendManager>();
            IBasicBackend   mockBackend        = Substitute.For <IBasicBackend>();

            mockBackend.GetDateTime().Returns(i_curTime);
            mockBackendManager.GetBackend <IBasicBackend>().Returns(mockBackend);

            SingleLoginPromoProgressSaveData systemUnderTest = new SingleLoginPromoProgressSaveData();

            systemUnderTest.LastCollectedTime = (long)i_lastCollectedTime.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;

            bool hasClaimedToday = systemUnderTest.HasRewardBeenClaimedToday(mockBackendManager);

            Assert.AreEqual(i_expected, hasClaimedToday);
        }