Inheritance: AbstractProjectData
        public void release_debug_type_should_be_pdb_only()
        {
            projectProvider
                .LoadProjectDocument()
                .Returns(XDocument.Parse(Resources.ProjectFileWithReleaseDebugTypeFull));

            var propertyGroups = new ProjectPropertyGroups(projectProvider);
            var failures = Convention.GetFailures(new ConfigurationHasSpecificValue(ConfigurationType.Release, "DebugType", "pdbonly"), propertyGroups);

            failures.ShouldMatchApproved();
        }
        public void can_parse_a_normal_project_file_to_read_global_debug_and_release_property_groups()
        {
            projectProvider
                   .LoadProjectDocument(Arg.Any<string>())
                   .Returns(XDocument.Parse(Resources.ProjectFileWithBinReference));

            var projectGroups = new ProjectPropertyGroups(typeof(ProjectPropertyGroups).Assembly, projectProvider, Substitute.For<IProjectLocator>());
            
            Assert.That(projectGroups.PropertyGroups.Length, Is.EqualTo(3));
            Assert.That(projectGroups.PropertyGroups.Any(item => item.Debug));
            Assert.That(projectGroups.PropertyGroups.Any(item => item.Release));
            Assert.That(projectGroups.PropertyGroups.Any(item => item.Global));
        }
        public void can_parse_a_normal_project_file_to_read_global_debug_and_release_property_groups()
        {
            projectProvider
                   .LoadProjectDocument()
                   .Returns(XDocument.Parse(Resources.ProjectFileWithBinReference));

            var projectGroups = new ProjectPropertyGroups(projectProvider);
            
            Assert.That(projectGroups.PropertyGroups.Length, Is.EqualTo(3));
            Assert.That(projectGroups.PropertyGroups.Any(item => item.Debug));
            Assert.That(projectGroups.PropertyGroups.Any(item => item.Release));
            Assert.That(projectGroups.PropertyGroups.Any(item => item.Global));
        }
        public void release_debug_type_should_be_pdb_only()
        {
            projectProvider
                .LoadProjectDocument(Arg.Any<string>())
                .Returns(XDocument.Parse(Resources.ProjectFileWithReleaseDebugTypeFull));

            var projectLocator = Substitute.For<IProjectLocator>();
            var propertyGroups = new ProjectPropertyGroups(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator);
            var ex =
                Assert.Throws<ConventionFailedException>(
                    () => Convention.Is(new ConfigurationHasSpecificValue(ConfigurationType.Release, "DebugType", "pdbonly"), propertyGroups));

            Approvals.Verify(ex.Message);
        }
        public void all_configuration_groups_should_have_platform_AnyCPU()
        {
            projectProvider
                .LoadProjectDocument()
                .Returns(XDocument.Parse(Resources.ProjectFileWithReleaseDebugTypeFull));

            var propertyGroups = new ProjectPropertyGroups(projectProvider);
            var failures = Convention.GetFailures(new ConfigurationHasSpecificValue(ConfigurationType.All, "Platform", "AnyCPU"), propertyGroups);

            failures.ShouldMatchApproved();
        }
        public void all_configuration_groups_should_have_optimize_true_if_property_defined()
        {
            projectProvider
                .LoadProjectDocument()
                .Returns(XDocument.Parse(Resources.ProjectFileWithReleaseDebugTypeFull));

            var propertyGroups = new ProjectPropertyGroups(projectProvider);
            var failures =
                Convention.GetFailures(new ConfigurationHasSpecificValue(ConfigurationType.All, "Optimize", "true"),
                    propertyGroups);

            failures.ShouldMatchApproved();
        }
        public void all_configuration_groups_should_have_platform_AnyCPU()
        {
            projectProvider
                .LoadProjectDocument(Arg.Any<string>())
                .Returns(XDocument.Parse(Resources.ProjectFileWithReleaseDebugTypeFull));

            var projectLocator = Substitute.For<IProjectLocator>();
            var propertyGroups = new ProjectPropertyGroups(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator);
            var ex =
                Assert.Throws<ConventionFailedException>(
                    () => Convention.Is(new ConfigurationHasSpecificValue(ConfigurationType.All, "Platform", "AnyCPU"), propertyGroups));

            Approvals.Verify(ex.Message);
        }
 public void release_configurations_should_have_optimize_true()
 {
     var configurationHasSpecificValue = new ConfigurationHasSpecificValue(ConfigurationType.Release, "Optimize", "true");
     var projectPropertyGroups = new ProjectPropertyGroups(projectLocation);
     Convention.Is(configurationHasSpecificValue, projectPropertyGroups);
 }
 public void release_configurations_should_have_debug_type_pdb_only()
 {
     var configurationHasSpecificValue = new ConfigurationHasSpecificValue(ConfigurationType.Release, "DebugType", "pdbonly");
     var projectPropertyGroups = new ProjectPropertyGroups(projectLocation);
     Convention.Is(configurationHasSpecificValue, projectPropertyGroups);
 }
 public void debug_configurations_should_have_optimize_false()
 {
     var configurationHasSpecificValue = new ConfigurationHasSpecificValue(ConfigurationType.Debug, "Optimize", "false");
     var projectPropertyGroups = new ProjectPropertyGroups(projectLocation);
     Convention.Is(configurationHasSpecificValue, projectPropertyGroups);
 }