Exemplo n.º 1
0
        public void CreateContextAndRegister() {
            // Arrange
            string[] expectedNamespaces = new string[] { "System.Web.Mvc.Test.*" };

            RouteCollection routes = new RouteCollection();
            MyAreaRegistration registration = new MyAreaRegistration();

            // Act
            registration.CreateContextAndRegister(routes, "some state");

            // Assert
            CollectionAssert.AreEqual(expectedNamespaces, registration.Namespaces, "Namespace should have been auto-populated.");
            Assert.AreEqual("some state", registration.State);
        }
        public void CreateContextAndRegister()
        {
            // Arrange
            string[] expectedNamespaces = new string[] { "System.Web.Mvc.Test.*" };

            RouteCollection    routes       = new RouteCollection();
            MyAreaRegistration registration = new MyAreaRegistration();

            // Act
            registration.CreateContextAndRegister(routes, "some state");

            // Assert
            Assert.Equal(expectedNamespaces, registration.Namespaces);
            Assert.Equal("some state", registration.State);
        }
Exemplo n.º 3
0
        public void ActionLinkProducesLowercaseUrlsAfterRegisteringAnArea()
        {
            // Arrange
            HtmlHelper         htmlHelper = MvcHelper.GetHtmlHelper();
            MyAreaRegistration myArea     = new MyAreaRegistration();

            myArea.CreateContextAndRegister(htmlHelper.RouteCollection, null);
            htmlHelper.RouteCollection.LowercaseUrls = true;

            // Act
            MvcHtmlString html = htmlHelper.ActionLink("about", "About", "Home");

            // Assert
            Assert.True(html.ToHtmlString() == html.ToHtmlString().ToLowerInvariant());
        }
        public void ActionLinkProducesLowercaseUrlsAfterRegisteringAnArea()
        {
            // Arrange
            HtmlHelper htmlHelper = MvcHelper.GetHtmlHelper();
            MyAreaRegistration myArea = new MyAreaRegistration();
            myArea.CreateContextAndRegister(htmlHelper.RouteCollection, null);
            htmlHelper.RouteCollection.LowercaseUrls = true;

            // Act
            MvcHtmlString html = htmlHelper.ActionLink("about", "About", "Home");

            // Assert
            Assert.True(html.ToHtmlString() == html.ToHtmlString().ToLowerInvariant());
        }