Esempio n. 1
0
        public void IndexSpecialCharactersTest(string searchTerm)
        {
            //Setup the fakes and dummies
            var loggerFake   = A.Fake <IApplicationLogger>();
            var contentValue = "http://www.search.com?searcherm={0}";

            // Set up calls
            var modelContent = string.Format(contentValue, HttpUtility.UrlEncode(Regex.Replace(searchTerm, Constants.ValidBAUSearchCharacters, string.Empty)));

            //Instantiate & Act
            using (var bauSearchResultsSignPostController = new BauSearchResultsSignpostController(loggerFake)
            {
                BannerContent = contentValue
            })
            {
                //Act
                var indexMethodCall = bauSearchResultsSignPostController.WithCallTo(c => c.Index(searchTerm));

                //Assert
                indexMethodCall
                .ShouldRenderDefaultView().WithModel <BauSearchResultsViewModel>(vm =>
                {
                    vm.Content.Should().BeEquivalentTo(modelContent);
                })
                .AndNoModelErrors();
            }
        }
Esempio n. 2
0
        public void IndexTest(string searchTerm)
        {
            //Setup the fakes and dummies
            var loggerFake   = A.Fake <IApplicationLogger>();
            var contentValue = "http://www.search.com?searcherm={0}";

            // Set up calls
            var modelContent = string.Format(contentValue, searchTerm);

            //Instantiate & Act
            var bauSearchResultsSignPostController = new BauSearchResultsSignpostController(loggerFake)
            {
                BannerContent = contentValue
            };

            //Act
            var indexMethodCall = bauSearchResultsSignPostController.WithCallTo(c => c.Index(searchTerm));

            //Assert
            indexMethodCall
            .ShouldRenderDefaultView().WithModel <BauSearchResultsViewModel>(vm =>
            {
                vm.Content.Should().BeEquivalentTo(modelContent);
            })
            .AndNoModelErrors();
        }