Exemplo n.º 1
0
        public void DoesHaveDisplayForPromo_ReturnsFalse_WhenDisplayNotInList()
        {
            LoginPromoDisplaysPM systemUnderTest = CreateSystem();

            systemUnderTest.DisplayPMs = new List <ISingleLoginPromoDisplayPM>();

            Assert.IsFalse(systemUnderTest.DoesHaveDisplayForPromo("Test"));
        }
Exemplo n.º 2
0
        public void WhenCreating_ForEachActivePromo_DisplayPM_IsSpawned()
        {
            MockManager.ActivePromotionData.Returns(new Dictionary <string, ILoginPromotionData>()
            {
                { "A", Substitute.For <ILoginPromotionData>() }, { "B", Substitute.For <ILoginPromotionData>() }
            });
            LoginPromoDisplaysPM systemUnderTest = CreateSystem();

            Assert.AreEqual(2, systemUnderTest.DisplayPMs.Count);
        }
Exemplo n.º 3
0
        public void WhenDisplayingPromo_EachPromoPM_IsNotified()
        {
            LoginPromoDisplaysPM systemUnderTest = CreateSystem();

            systemUnderTest.DisplayPMs = CreateMockDisplayPMs(5);

            systemUnderTest.DisplayPromoAndHideOthers("Test");

            foreach (ISingleLoginPromoDisplayPM pm in systemUnderTest.DisplayPMs)
            {
                pm.Received().UpdateVisibilityBasedOnCurrentlyDisplayedPromo("Test");
            }
        }
Exemplo n.º 4
0
        public void DoesHaveDisplayForPromo_ReturnsTrue_WhenDisplayInList()
        {
            List <ISingleLoginPromoDisplayPM> mockDisplays = new List <ISingleLoginPromoDisplayPM>();
            ISingleLoginPromoDisplayPM        mockDisplay  = Substitute.For <ISingleLoginPromoDisplayPM>();

            mockDisplay.GetId().Returns("Test");
            mockDisplays.Add(mockDisplay);

            LoginPromoDisplaysPM systemUnderTest = CreateSystem();

            systemUnderTest.DisplayPMs = mockDisplays;

            Assert.IsTrue(systemUnderTest.DoesHaveDisplayForPromo("Test"));
        }
Exemplo n.º 5
0
        private LoginPromoDisplaysPM CreateSystem()
        {
            LoginPromoDisplaysPM systemUnderTest = new LoginPromoDisplaysPM(MockSpawner, MockManager);

            return(systemUnderTest);
        }