예제 #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");
        }