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));
        }
        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));
        }
Ejemplo n.º 7
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));
        }