Example #1
0
        static void TestParseEditorConfigCodeStyleOption(string args, bool isEnabled, DiagnosticSeverity severity)
        {
            var notificationOption = NotificationOption.None;

            switch (severity)
            {
            case DiagnosticSeverity.Hidden:
                notificationOption = NotificationOption.None;
                break;

            case DiagnosticSeverity.Info:
                notificationOption = NotificationOption.Suggestion;
                break;

            case DiagnosticSeverity.Warning:
                notificationOption = NotificationOption.Warning;
                break;

            case DiagnosticSeverity.Error:
                notificationOption = NotificationOption.Error;
                break;
            }

            var codeStyleOption = new CodeStyleOption <bool>(value: isEnabled, notification: notificationOption);

            CodeStyleHelpers.TryParseEditorConfigCodeStyleOption(args, out var result);
            Assert.True(result.Value == isEnabled,
                        $"Expected {nameof(isEnabled)} to be {isEnabled}, was {result.Value}");
            Assert.True(result.Notification.Value == severity,
                        $"Expected {nameof(severity)} to be {severity}, was {result.Notification.Value}");
        }
Example #2
0
 private static Optional <CodeStyleOption <bool> > ParseBoolCodeStyleOption(string str)
 => CodeStyleHelpers.TryParseEditorConfigCodeStyleOption(str, out var result) ? result : new Optional <CodeStyleOption <bool> >();