Ejemplo n.º 1
0
        public void When_user_has_accepted_cookies_then_no_popup_is_to_be_displayed()
        {
            GivenTheUserHasAcceptedCookies();

            var result = TestInstance.GetCookiePopup();

            result.ShouldSatisfyAllConditions(() =>
            {
                result.ShowPopup.ShouldBe(false);
                result.Message.ShouldBe(string.Empty);
            });
        }
Ejemplo n.º 2
0
        public void When_user_has_not_accepted_cookies_then_a_formatted_popup_is_to_be_displayed()
        {
            GivenTheUserIsNamed("you");
            GivenTheUserHasAcceptedCookies(hasAccepted: false);
            GivenTheCookiePopupMessageTemplateIs($"Hi {CookieMessageTokens.USER_DISPLAY_NAME}!");

            var result = TestInstance.GetCookiePopup();

            result.ShouldSatisfyAllConditions(() =>
            {
                result.ShowPopup.ShouldBe(true);
                result.Message.ShouldBe("Hi you!");
            });
        }
        public void When_user_has_accepted_cookies_then_empty_popup_is_returned()
        {
            Mock.Get(GetDependency <IUser>())
            .Setup(x => x.HasAcceptedCookies)
            .Returns(true);

            var result = TestInstance.GetCookiePopup();

            result.ShouldSatisfyAllConditions(() =>
            {
                result.ShowPopup.ShouldBe(false);
                result.Message.ShouldBe(string.Empty);
            });
        }
        public void When_user_has_not_accepted_cookies_then_empty_popup_is_returned()
        {
            var user = GetDependency <IUser>();

            Mock.Get(user)
            .Setup(x => x.HasAcceptedCookies)
            .Returns(false);

            Mock.Get(GetDependency <ICookieMessageProvider>())
            .Setup(x => x.GetMessageTemplate())
            .Returns(AnyMessageTemplate);

            Mock.Get(GetDependency <ICookieMessageFormatter>())
            .Setup(x => x.FormatMessage(user, AnyMessageTemplate))
            .Returns(AnyFormattedMessage);

            var result = TestInstance.GetCookiePopup();

            result.ShouldSatisfyAllConditions(() =>
            {
                result.ShowPopup.ShouldBe(true);
                result.Message.ShouldBe(AnyFormattedMessage);
            });
        }