public void OptimizationLevel_ParsePdbSerializedString(OptimizationLevel optimization, bool debugPlus)
        {
            var data = OptimizationLevelFacts.ToPdbSerializedString(optimization, debugPlus);

            Assert.True(OptimizationLevelFacts.TryParsePdbSerializedString(data, out var optimization2, out var debugPlus2));
            Assert.Equal(optimization, optimization2);
            Assert.Equal(debugPlus, debugPlus2);
        }
Example #2
0
        protected static (OptimizationLevel OptimizationLevel, bool DebugPlus) GetOptimizationLevel(string?value)
        {
            if (value is null)
            {
                return(OptimizationLevelFacts.DefaultValues);
            }

            if (!OptimizationLevelFacts.TryParsePdbSerializedString(value, out OptimizationLevel optimizationLevel, out bool debugPlus))
            {
                throw new InvalidOperationException();
            }

            return(optimizationLevel, debugPlus);
        }