Exemplo n.º 1
0
        public void ParseManifest_ThrowsFor_UnknownVersion()
        {
            // Arrange
            var manifestContent = @"<StaticWebAssets Version=""2.0""/>";
            var manifest        = CreateManifest(manifestContent);

            // Act & Assert
            var exception = Assert.Throws <InvalidOperationException>(() => StaticWebAssetsReader.Parse(manifest).ToArray());

            Assert.StartsWith("Unknown manifest version", exception.Message);
        }
Exemplo n.º 2
0
        public void ParseManifest_ThrowsFor_EmptyManifest()
        {
            // Arrange
            var manifestContent = @"";
            var manifest        = CreateManifest(manifestContent);

            // Act & Assert
            var exception = Assert.Throws <XmlException>(() => StaticWebAssetsReader.Parse(manifest).ToArray());

            Assert.StartsWith("Root element is missing.", exception.Message);
        }
Exemplo n.º 3
0
        public void ParseManifest_ThrowsFor_UnknownRootElement()
        {
            // Arrange
            var manifestContent = @"<Invalid />";
            var manifest        = CreateManifest(manifestContent);

            // Act & Assert
            var exception = Assert.Throws <InvalidOperationException>(() => StaticWebAssetsReader.Parse(manifest).ToArray());

            Assert.StartsWith("Invalid manifest", exception.Message);
        }
Exemplo n.º 4
0
        public void ParseManifest_ThrowsFor_InvalidStaticWebAssetsChildren()
        {
            // Arrange
            var manifestContent = @"<StaticWebAssets Version=""1.0"">
    <Invalid />
</StaticWebAssets>";
            var manifest        = CreateManifest(manifestContent);

            // Act & Assert
            var exception = Assert.Throws <InvalidOperationException>(() => StaticWebAssetsReader.Parse(manifest).ToArray());

            Assert.StartsWith("Invalid manifest", exception.Message);
        }
Exemplo n.º 5
0
        public void ParseManifest_ParsesManifest_WithSingleItem()
        {
            // Arrange
            var manifestContent = @"<StaticWebAssets Version=""1.0"">
    <ContentRoot Path=""/Path"" BasePath=""/BasePath"" />
</StaticWebAssets>";

            var manifest = CreateManifest(manifestContent);

            // Act
            var mappings = StaticWebAssetsReader.Parse(manifest).ToArray();

            // Assert
            var mapping = Assert.Single(mappings);

            Assert.Equal("/Path", mapping.Path);
            Assert.Equal("/BasePath", mapping.BasePath);
        }