コード例 #1
0
ファイル: UrlHelperBaseTest.cs プロジェクト: wserr/AspNetCore
        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());
        }
コード例 #2
0
ファイル: UrlHelperBaseTest.cs プロジェクト: wserr/AspNetCore
        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());
        }