Esempio n. 1
0
        public void AppendPathAndFragment_HandlesLeadingAndTrailingSlashes(
            string appBase,
            string virtualPath,
            string expected)
        {
            // Arrange
            var services    = CreateServices();
            var httpContext = CreateHttpContext(services, appBase, host: null, protocol: null);
            var builder     = new StringBuilder();

            // Act
            UrlHelperBase.AppendPathAndFragment(builder, httpContext.Request.PathBase, virtualPath, string.Empty);

            // Assert
            Assert.Equal(expected, builder.ToString());
        }
Esempio n. 2
0
        public void AppendPathAndFragment_AppendsFragments(
            string appBase,
            string virtualPath,
            string expected)
        {
            // Arrange
            var fragmentValue = "fragment-value";

            expected += $"#{fragmentValue}";
            var services    = CreateServices();
            var httpContext = CreateHttpContext(services, appBase, host: null, protocol: null);
            var builder     = new StringBuilder();

            // Act
            UrlHelperBase.AppendPathAndFragment(builder, httpContext.Request.PathBase, virtualPath, fragmentValue);

            // Assert
            Assert.Equal(expected, builder.ToString());
        }