コード例 #1
0
        public void StaticWebAssetsFileProvider_FindsFileWithSpaces()
        {
            // Arrange & Act
            var provider = new StaticWebAssetsFileProvider("/_content",
                                                           Path.Combine(AppContext.BaseDirectory, "testroot", "wwwroot"));

            // Assert
            Assert.True(provider.GetFileInfo("/_content/Static Web Assets.txt").Exists);
        }
コード例 #2
0
        public void GetFileInfo_Prefix_RespectsOsCaseSensitivity()
        {
            // Arrange
            var expectedResult = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
            var provider       = new StaticWebAssetsFileProvider(
                "_content",
                Path.GetDirectoryName(new Uri(typeof(StaticWebAssetsFileProviderTests).Assembly.CodeBase).LocalPath));

            // Act
            var file = provider.GetFileInfo("/_CONTENT/Microsoft.AspNetCore.Hosting.StaticWebAssets.xml");

            // Assert
            Assert.Equal(expectedResult, file.Exists);
        }
コード例 #3
0
        public void GetFileInfo_DoesNotMatch_IncompletePrefixSegments()
        {
            // Arrange
            var expectedResult = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
            var provider       = new StaticWebAssetsFileProvider(
                "_cont",
                Path.GetDirectoryName(new Uri(typeof(StaticWebAssetsFileProviderTests).Assembly.CodeBase).LocalPath));

            // Act
            var file = provider.GetFileInfo("/_content/Microsoft.AspNetCore.TestHost.StaticWebAssets.xml");

            // Assert
            Assert.False(file.Exists, "File exists");
        }
コード例 #4
0
        public void GetFileInfo_Prefix_RespectsOsCaseSensitivity()
        {
            // Arrange
            var expectedResult = OperatingSystem.IsWindows();
            var provider       = new StaticWebAssetsFileProvider(
                "_content",
                Path.GetDirectoryName(typeof(StaticWebAssetsFileProviderTests).Assembly.Location));

            // Act
            var file = provider.GetFileInfo("/_CONTENT/Microsoft.AspNetCore.Hosting.StaticWebAssets.xml");

            // Assert
            Assert.Equal(expectedResult, file.Exists);
        }
コード例 #5
0
        public void GetFileInfo_DoesNotMatch_IncompletePrefixSegments()
        {
            // Arrange
            var expectedResult = OperatingSystem.IsWindows();
            var provider       = new StaticWebAssetsFileProvider(
                "_cont",
                Path.GetDirectoryName(typeof(StaticWebAssetsFileProviderTests).Assembly.Location));

            // Act
            var file = provider.GetFileInfo("/_content/Microsoft.AspNetCore.TestHost.StaticWebAssets.xml");

            // Assert
            Assert.False(file.Exists, "File exists");
        }