Exemple #1
0
        public void WebConfig_HelpPageReferencesCorrectMvcHostVersion()
        {
            // Arrange
            Version mvcVersion = VersionTestHelper.GetVersionFromAssembly(
                "System.Web.Mvc",
                typeof(Controller)
                );
            string expectedFactoryType =
                "System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version="
                + mvcVersion
                + ", Culture=neutral, PublicKeyToken=31BF3856AD364E35";

            using (
                Stream webConfigStream = typeof(WebConfigTest).Assembly.GetManifestResourceStream(
                    @"WebApiHelpPage.TestFiles.Web.config"
                    )
                )
            {
                XDocument document = XDocument.Load(webConfigStream);

                // Act
                string actualFactoryType =
                    document.Root
                    .Element("system.web.webPages.razor")
                    .Element("host")
                    .Attribute("factoryType").Value;

                // Assert
                Assert.Equal(expectedFactoryType, actualFactoryType);
            }
        }
Exemple #2
0
        public static ISetup <HttpContextBase> ExpectMvcVersionResponseHeader(this Mock <HttpContextBase> mock)
        {
            Version mvcVersion = VersionTestHelper.GetVersionFromAssembly("System.Web.Mvc", typeof(Controller));

            string majorMinor = mvcVersion.Major + "." + mvcVersion.Minor;

            return(mock.Setup(r => r.Response.AppendHeader(MvcHandler.MvcVersionHeaderName, majorMinor)));
        }
Exemple #3
0
        public void VerifyMVCVersionChangesAreIntentional()
        {
            Version mvcVersion = VersionTestHelper.GetVersionFromAssembly(
                "System.Web.Mvc",
                typeof(Controller)
                );

            Assert.Equal(new Version(5, 2, 7, 0), mvcVersion);
        }