public void WhenDone_ExpectedMessagesUnsubscribed()
        {
            ShowLoginPromosStep systemUnderTest = CreateSystem();

            systemUnderTest.Done();

            CheckStepIsDone();
        }
        public void WhenStarted_IfNoActivePromos_StepIsDone()
        {
            ShowLoginPromosStep systemUnderTest = CreateSystem();

            systemUnderTest.Start();

            CheckStepIsDone();
        }
        public void WhenStarting_ExpectedMessagesSubscribed()
        {
            ShowLoginPromosStep systemUnderTest = CreateSystem();

            systemUnderTest.Start();

            MockMessenger.Received().AddListener(SingleLoginPromoDisplayPM.PROMO_DISMISSED_EVENT, Arg.Any <Callback>());
        }
        public void WhenCreated_ActivePromos_MatchesManagerActivePromos()
        {
            List <ISingleLoginPromoProgressSaveData> mockActivePromos = new List <ISingleLoginPromoProgressSaveData>();

            MockPromoManager.GetActivePromoSaveData().Returns(mockActivePromos);

            ShowLoginPromosStep systemUnderTest = CreateSystem();

            Assert.AreEqual(mockActivePromos, systemUnderTest.ActivePromoSaveData);
        }
        public void WhenStarted_IfActivePromos_AndPromoShouldNotShow_PromoIsNotShown()
        {
            MockHelper.ShouldShowPromoAsPopup(Arg.Any <ISingleLoginPromoProgressSaveData>(), Arg.Any <ILoginPromotionData>()).Returns(false);
            SetActiveProgressOnMockManagerWithIds(new List <string>()
            {
                "Test_1"
            });

            ShowLoginPromosStep systemUnderTest = CreateSystem();

            systemUnderTest.Start();

            MockAllPromosPM.DidNotReceive().DisplayPromoAndHideOthers("Test_1");
        }
        public void WhenPromoIsDismissed_IfNoOtherPromos_StepIsDone()
        {
            SetActiveProgressOnMockManagerWithIds(new List <string>()
            {
                "Test_1"
            });

            ShowLoginPromosStep systemUnderTest = CreateSystem();

            systemUnderTest.Start();
            systemUnderTest.ProcessNextPromotion();

            CheckStepIsDone();
        }
        public void WhenPromoIsDismissed_IfOtherPromos_NextPromoIsShown()
        {
            MockHelper.ShouldShowPromoAsPopup(Arg.Any <ISingleLoginPromoProgressSaveData>(), Arg.Any <ILoginPromotionData>()).Returns(true);
            SetActiveProgressOnMockManagerWithIds(new List <string>()
            {
                "Test_1", "Test_2"
            });

            ShowLoginPromosStep systemUnderTest = CreateSystem();

            systemUnderTest.Start();
            systemUnderTest.ProcessNextPromotion();

            MockAllPromosPM.Received().DisplayPromoAndHideOthers("Test_2");
        }
        private ShowLoginPromosStep CreateSystem()
        {
            ShowLoginPromosStep systemUnderTest = new ShowLoginPromosStep(MockBackend, MockHelper, MockAllPromosPM, MockPromoManager, MockMessenger, MockFlowManager);

            return(systemUnderTest);
        }