public void WhenSecondaryButtonInvoked_ThenViewModelIsUpdated(string key, string expected)
        {
            var component = new SecondaryButton();

            component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext();

            ViewViewComponentResult result      = component.Invoke(new Dictionary <string, string>()) as ViewViewComponentResult;
            ButtonModel             resultModel = (ButtonModel)result.ViewData.Model;

            //Assert
            resultModel.AdditionalClass.Should().BeEquivalentTo(expected);
        }
        public void WhenWarningButtonInvoked_ThenViewModelIsUpdated(string key, string expected)
        {
            var component = new WarningButton();

            component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext();

            ViewViewComponentResult result      = component.Invoke(new Dictionary <string, string>()) as ViewViewComponentResult;
            ButtonModel             resultModel = (ButtonModel)result.ViewData.Model;

            //Assert
            expected.Should().Be(ViewComponentTestHelper.GetPropertyValue(resultModel, key));
        }
        public void WhenBackLinkInvoked_ThenViewModelLinkTextShouldBeSetToBackAsDefault()
        {
            var values = new Dictionary <string, string>()
            {
            };

            var component = new BackLink();

            component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext();

            ViewViewComponentResult result = component.Invoke(values) as ViewViewComponentResult;
            LinkModel resultModel          = (LinkModel)result.ViewData.Model;

            //Assert
            "Back".Should().Be(ViewComponentTestHelper.GetPropertyValue(resultModel, "LinkText"));
        }
        public void WhenRadioHintInvoked_TheViewModelIsUpdated(string key, string value)
        {
            var values = new Dictionary <string, string>()
            {
            };

            var component = new RadioHint();

            component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext();

            ViewViewComponentResult result = component.Invoke(values) as ViewViewComponentResult;
            HintModel resultModel          = (HintModel)result.ViewData.Model;

            //Assert
            value.Should().Be(ViewComponentTestHelper.GetPropertyValue(resultModel, key));
        }
        public void WhenPrimaryHeroBannerInvoked_ThenViewModelIsUpdated(string key, string value)
        {
            var values = new Dictionary <string, string>()
            {
                { key, value }
            };

            var component = new PrimaryHeroBanner();

            component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext();

            ViewViewComponentResult result      = component.Invoke(values) as ViewViewComponentResult;
            BannerModel             resultModel = (BannerModel)result.ViewData.Model;

            //Assert
            value.Should().Be(ViewComponentTestHelper.GetPropertyValue(resultModel, key));
        }
        public void WhenCheckBoxInvoked_ThenViewModelIsUpdated(string key, string value)
        {
            var values = new Dictionary <string, string>()
            {
                { key, value }
            };

            var component = new Checkbox();

            component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext();

            ViewViewComponentResult result      = component.Invoke(values) as ViewViewComponentResult;
            CheckBoxModel           resultModel = (CheckBoxModel)result.ViewData.Model;

            //Assert
            Assert.AreEqual(value, ViewComponentTestHelper.GetPropertyValue(resultModel, key));
        }
Exemple #7
0
        public void WhenRadioLabelInvoked_TheViewModelIsUpdated(string key, string value)
        {
            var values = new Dictionary <string, string>()
            {
                { key, value }
            };

            var component = new RadioLabel();

            component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext();

            ViewViewComponentResult result = component.Invoke(values) as ViewViewComponentResult;
            LabelModel resultModel         = (LabelModel)result.ViewData.Model;

            //Assert
            resultModel.AdditionalClass.Should().Contain(value);
        }
        public void WhenStartButtonLinkInvoked_ThenViewModelIsUpdated(string key, string value)
        {
            var values = new Dictionary <string, string>()
            {
                { key, value }
            };

            var component = new StartButtonLink
            {
                ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext(),
            };

            ViewViewComponentResult result = component.Invoke(values) as ViewViewComponentResult;
            LinkModel resultModel          = (LinkModel)result.ViewData.Model;

            //Assert
            value.Should().Be(ViewComponentTestHelper.GetPropertyValue(resultModel, key));
        }
Exemple #9
0
        public void When_PhaseBannerInvoked_Then_ViewModelIsUpdated(string key, string value)
        {
            // Arrange.
            var values = new Dictionary <string, string>()
            {
                { key, value }
            };
            var component = new PhaseBanner
            {
                ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext()
            };

            // Act.
            var result      = component.Invoke(values) as ViewViewComponentResult;
            var resultModel = result.ViewData.Model as PhaseBannerModel;

            //Assert
            value.Should().Be(ViewComponentTestHelper.GetPropertyValue(resultModel, key));
        }
Exemple #10
0
        public void When_PhaseBannerInvokedWithNoAttributes_Then_DefaultValuesShouldBeUsed()
        {
            // Arrange.
            var values = new Dictionary <string, string>()
            {
            };
            var component = new PhaseBanner()
            {
                ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext()
            };

            // Act.
            var result      = component.Invoke(values) as ViewViewComponentResult;
            var resultModel = result.ViewData.Model as PhaseBannerModel;

            //Assert
            resultModel.Id.Should().BeNull();
            resultModel.Phase.Should().Be(IPhaseBanner.ProjectPhase.Alpha);
            resultModel.FeedbackHref.Should().Be("#");
        }