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

            // Act
            var result = LatestProjectConfigurationProvider.TryGetDefaultConfiguration(projectInstance, out var defaultConfiguration);

            // Assert
            Assert.False(result);
            Assert.Null(defaultConfiguration);
        }
Beispiel #2
0
        public void TryGetDefaultConfiguration_FailsIfEmptyConfiguration()
        {
            // Arrange
            var projectInstance = new ProjectInstance(ProjectRootElement.Create());

            projectInstance.SetProperty("RazorDefaultConfiguration", string.Empty);

            // Act
            var result = LatestProjectConfigurationProvider.TryGetDefaultConfiguration(projectInstance, out var defaultConfiguration);

            // Assert
            Assert.False(result);
            Assert.Null(defaultConfiguration);
        }
Beispiel #3
0
        public void TryGetDefaultConfiguration_SucceedsWithValidConfiguration()
        {
            // Arrange
            var expectedConfiguration = "Razor-13.37";
            var projectInstance       = new ProjectInstance(ProjectRootElement.Create());

            projectInstance.SetProperty("RazorDefaultConfiguration", expectedConfiguration);

            // Act
            var result = LatestProjectConfigurationProvider.TryGetDefaultConfiguration(projectInstance, out var defaultConfiguration);

            // Assert
            Assert.True(result);
            Assert.Equal(expectedConfiguration, defaultConfiguration);
        }