Пример #1
0
        public void CreatingProjectConfig_WithNullProjectReferences_ThrowsArgumentExceptionForProjectReferences()
        {
            // Arrange
            var    projectPropertiesConfig = new ProjectPropertiesConfiguration("NS", "AS", ProjectOutputType.ConsoleApplication);
            Action action = () => new ProjectConfigurationFile("Test", new List <ProjectAssemblyReference>(), null, projectPropertiesConfig, new List <ProjectBuildConfiguration>());
            var    expectedExceptionMessage = string.Format(Guard.NullObjectExceptionMessage, "projectReferences");

            // Act & Assert
            action.Should().Throw <ArgumentException>().WithMessage(expectedExceptionMessage);
        }
Пример #2
0
        public ProjectPropertiesConfiguration CreateFromDocument(XDocument document)
        {
            var configurationElement = document.Descendants().First(f => f.Name.LocalName == ProjectConfigConstants.ConfigurationTagName).Parent;

            var rootNamespace    = _xmlParsingService.TryParsingSubElementStringValue(configurationElement, ProjectConfigConstants.RootNamespaceLocalName);
            var assemblyName     = _xmlParsingService.TryParsingSubElementStringValue(configurationElement, ProjectConfigConstants.AssemblyNameLocalName);
            var outputTypeString = _xmlParsingService.TryParsingSubElementStringValue(configurationElement, ProjectConfigConstants.OutputTypeLocalName);
            var outputType       = ProjectOutputType.Parse(outputTypeString);

            var result = new ProjectPropertiesConfiguration(rootNamespace, assemblyName, outputType);

            return(result);
        }
Пример #3
0
        public void CreatingProjectConfig_WithAllParametersSet_CreatesProjectConfig()
        {
            // Act
            var projectPropertiesConfig = new ProjectPropertiesConfiguration("NS", "AS", ProjectOutputType.ConsoleApplication);
            var actualProjectConfig     = new ProjectConfigurationFile(
                "Test",
                new List <ProjectAssemblyReference>(),
                new List <ProjectReference>(),
                projectPropertiesConfig,
                new List <ProjectBuildConfiguration>());

            // Assert
            Assert.That(actualProjectConfig, Is.Not.Null);
        }