コード例 #1
0
        public void TryGetConfigurationItem_FailsNoRazorConfigurationItems()
        {
            // Arrange
            var projectItems = Enumerable.Empty <IMSBuildItemEvaluated>();

            // Act
            var result = DefaultRazorProjectHost.TryGetConfigurationItem("Razor-13.37", projectItems, out var configurationItem);

            // Assert
            Assert.False(result);
            Assert.Null(configurationItem);
        }
コード例 #2
0
        public void TryGetConfigurationItem_FailsNoMatchingRazorConfigurationItems()
        {
            // Arrange
            var projectItems = new IMSBuildItemEvaluated[]
            {
                new TestMSBuildItem("RazorConfiguration")
                {
                    Include = "Razor-10.0",
                }
            };

            // Act
            var result = DefaultRazorProjectHost.TryGetConfigurationItem("Razor-13.37", projectItems, out var configurationItem);

            // Assert
            Assert.False(result);
            Assert.Null(configurationItem);
        }
コード例 #3
0
        public void TryGetConfigurationItem_SucceedsForMatchingConfigurationItem()
        {
            // Arrange
            var expectedConfiguration     = "Razor-13.37";
            var expectedConfigurationItem = new TestMSBuildItem("RazorConfiguration")
            {
                Include = expectedConfiguration,
            };
            var projectItems = new IMSBuildItemEvaluated[]
            {
                new TestMSBuildItem("RazorConfiguration")
                {
                    Include = "Razor-10.0-DoesNotMatch",
                },
                expectedConfigurationItem
            };

            // Act
            var result = DefaultRazorProjectHost.TryGetConfigurationItem(expectedConfiguration, projectItems, out var configurationItem);

            // Assert
            Assert.True(result);
            Assert.Same(expectedConfigurationItem, configurationItem);
        }