Exemple #1
0
        public void TryResolveConfiguration_NoSystemWebRazorReference_ReturnsFalse()
        {
            // Arrange
            var context  = BuildContext("/some/path/to/System.Foo.Razor.dll");
            var provider = new SystemWebConfigurationProvider();

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

            // Assert
            Assert.False(result);
            Assert.Null(configuration);
        }
Exemple #2
0
        public void TryResolveConfiguration_MvcWithVersion_ReturnsTrue()
        {
            // Arrange
            var context  = BuildContext("/some/path/to/some.dll", "/another/path/to/" + SystemWebConfigurationProvider.SystemWebRazorAssemblyFileName);
            var provider = new SystemWebConfigurationProvider();

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

            // Assert
            Assert.True(result);
            Assert.Same(UnsupportedRazorConfiguration.Instance, projectConfiguration.Configuration);
        }
Exemple #3
0
        public void TryResolveConfiguration_RazorCoreCapability_ReturnsFalse()
        {
            // Arrange
            var projectCapabilities = new[]
            {
                CoreProjectConfigurationProvider.DotNetCoreRazorCapability,
            };
            var projectInstance = new ProjectInstance(ProjectRootElement.Create());

            projectInstance.AddItem(SystemWebConfigurationProvider.ReferencePathWithRefAssembliesItemType, SystemWebConfigurationProvider.SystemWebRazorAssemblyFileName);
            var context  = new ProjectConfigurationProviderContext(projectCapabilities, projectInstance);
            var provider = new SystemWebConfigurationProvider();

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

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