private void OptimizationDisabledFor(VCppProjectCompilerParameters p)
 {
     p.Favor.Should().Be(OptimizationFavor.Speed);
     p.Optimization.Should().Be(OptimizationLevel.Disabled);
     p.WholeProgramOptimization.Should().BeFalse();
     p.SmallerTypeCheck.Should().BeTrue();
 }
 public void DefaultDefinesForDebug()
 {
     var p = new VCppProjectCompilerParameters(debugSuite);
     HasDebugDefines(p);
 }
 public void DefaultDefinesForRelease()
 {
     var p = new VCppProjectCompilerParameters(releaseSuite);
     HasReleaseDefines(p);
 }
 private void HasReleaseDefines(VCppProjectCompilerParameters p)
 {
     p.Defines.Should().Contain("NDEBUG");
     p.Defines.Should().NotContain("_DEBUG");
 }
 public void OptimizationDisabledForCustomDebug()
 {
     var p1 = new VCppProjectCompilerParameters(customDebugSuite);
     OptimizationDisabledFor(p1);
 }
 public void OptimizationEnabledForCustomRelease()
 {
     var p1 = new VCppProjectCompilerParameters(customReleaseSuite);
     OptimizationEnabledFor(p1);
 }
        private XmlElement GetProperties(VCppProjectCompilerParameters p)
        {
            using (var writer = new StringWriter())
            using (var xmlWriter = new XmlTextWriter(writer))
            {
                xmlWriter.WriteStartElement("Root");
                p.ToVcxprojProperties(xmlWriter);
                xmlWriter.WriteEndElement();

                var doc = new XmlDocument();
                doc.LoadXml(writer.ToString());
                return doc.DocumentElement;
            }
        }
        public void DefaultReleaseOptimizationWrittenToVcxproj()
        {
            var p = new VCppProjectCompilerParameters(releaseSuite);
            var xml = GetProperties(p);

            var defineNodes = xml.SelectNodes("Optimization");
            defineNodes.Should().NotBeNull();
            defineNodes.Count.Should().Be(1);
            defineNodes[0].InnerText.Should().Be("Full");
        }
        public void DefaultReleaseDefinesWrittenToVcxproj()
        {
            var p = new VCppProjectCompilerParameters(releaseSuite);
            var xml = GetProperties(p);

            var defineNodes = xml.SelectNodes("PreprocessorDefinitions");
            defineNodes.Should().NotBeNull();
            defineNodes.Count.Should().Be(1);
            defineNodes[0].InnerText.Should().Be("NDEBUG");
        }