Example #1
0
        public void TryResolveConfiguration_NoMvcReference_ReturnsFalse()
        {
            // Arrange
            var context  = BuildContext("/some/path/to/some.dll");
            var provider = new TestLegacyConfigurationProvider(MvcAssemblyVersion);

            // Act
            var result = provider.TryResolveConfiguration(context, out var configuration);

            // Assert
            Assert.False(result);
            Assert.Null(configuration);
        }
Example #2
0
        public void TryResolveConfiguration_NoMvcVersion_ReturnsFalse()
        {
            // Arrange
            var context  = BuildContext("/some/path/to/some.dll", "/another/path/to/" + FallbackConfigurationProvider.MvcAssemblyFileName);
            var provider = new TestLegacyConfigurationProvider(mvcAssemblyVersion: null);

            // Act
            var result = provider.TryResolveConfiguration(context, out var configuration);

            // Assert
            Assert.False(result);
            Assert.Null(configuration);
        }
Example #3
0
        public void TryResolveConfiguration_MvcWithVersion_ReturnsTrue()
        {
            // Arrange
            var context  = BuildContext("/some/path/to/some.dll", "/another/path/to/" + FallbackConfigurationProvider.MvcAssemblyFileName);
            var provider = new TestLegacyConfigurationProvider(MvcAssemblyVersion);
            var expectedConfiguration = FallbackRazorConfiguration.SelectConfiguration(MvcAssemblyVersion);

            // Act
            var result = provider.TryResolveConfiguration(context, out var projectConfiguration);

            // Assert
            Assert.True(result);
            Assert.Same(expectedConfiguration, projectConfiguration.Configuration);
            Assert.Empty(projectConfiguration.Documents);
        }
Example #4
0
        public void TryResolveConfiguration_NoCoreCapability_ReturnsFalse()
        {
            // Arrange
            var projectCapabilities = Array.Empty <string>();
            var projectInstance     = new ProjectInstance(ProjectRootElement.Create());
            var context             = new ProjectConfigurationProviderContext(projectCapabilities, projectInstance);
            var provider            = new TestLegacyConfigurationProvider(MvcAssemblyVersion);

            // Act
            var result = provider.TryResolveConfiguration(context, out var configuration);

            // Assert
            Assert.False(result);
            Assert.Null(configuration);
        }