Esempio n. 1
0
        public void ResolveManifest_UsesConfigurationKey_WhenProvided()
        {
            // Arrange
            var expectedManifest = @"<StaticWebAssets Version=""1.0"">
  <ContentRoot Path=""/Path"" BasePath=""/BasePath"" />
</StaticWebAssets>
";
            var path             = Path.ChangeExtension(new Uri(typeof(StaticWebAssetsLoader).Assembly.CodeBase).LocalPath, ".StaticWebAssets.xml");
            var environment      = new HostingEnvironment()
            {
                ApplicationName = "NonExistingDll"
            };

            var configuration = new ConfigurationBuilder()
                                .AddInMemoryCollection(new Dictionary <string, string>()
            {
                [WebHostDefaults.StaticWebAssetsKey] = path
            }).Build();

            // Act
            var manifest = StaticWebAssetsLoader.ResolveManifest(environment, configuration);

            // Assert
            Assert.Equal(expectedManifest, new StreamReader(manifest).ReadToEnd());
        }
Esempio n. 2
0
        public void ResolveManifest_ManifestFromFile()
        {
            // Arrange
            var expectedManifest = @"<StaticWebAssets Version=""1.0"">
  <ContentRoot Path=""/Path"" BasePath=""/BasePath"" />
</StaticWebAssets>
";

            var environment = new HostingEnvironment()
            {
                ApplicationName = "Microsoft.AspNetCore.Hosting"
            };

            // Act
            var manifest = StaticWebAssetsLoader.ResolveManifest(environment);

            // Assert
            Assert.Equal(expectedManifest, new StreamReader(manifest).ReadToEnd());
        }