Beispiel #1
0
        public void GetExtensions_UnConfiguredExtensionTypes_ReturnsEmptyArray()
        {
            // Arrange
            var projectInstance = new ProjectInstance(ProjectRootElement.Create());

            projectInstance.AddItem("NotAnExtension", "UnconfiguredExtensionName");

            // Act
            var extensions = LatestProjectConfigurationProvider.GetExtensions(new[] { "Extension1", "Extension2" }, projectInstance.Items);

            // Assert
            Assert.Empty(extensions);
        }
Beispiel #2
0
        public void GetExtensions_SomeConfiguredExtensions_ReturnsConfiguredExtensions()
        {
            // Arrange
            var expectedExtension1Name = "Extension1";
            var expectedExtension2Name = "Extension2";
            var projectInstance        = new ProjectInstance(ProjectRootElement.Create());

            projectInstance.AddItem("NotAnExtension", "UnconfiguredExtensionName");
            projectInstance.AddItem("RazorExtension", expectedExtension1Name);
            projectInstance.AddItem("RazorExtension", expectedExtension2Name);

            // Act
            var extensions = LatestProjectConfigurationProvider.GetExtensions(new[] { expectedExtension1Name, expectedExtension2Name }, projectInstance.Items);

            // Assert
            Assert.Collection(
                extensions,
                extension => Assert.Equal(expectedExtension1Name, extension.ExtensionName),
                extension => Assert.Equal(expectedExtension2Name, extension.ExtensionName));
        }