Skip to content

Instantly share code, notes, and snippets.

@renatogroffe
Created September 17, 2024 16:58

Revisions

  1. renatogroffe created this gist Sep 17, 2024.
    25 changes: 25 additions & 0 deletions Program.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    using ConsoleAppPartialMethod.Helpers;
    using System.Runtime.InteropServices;

    Console.WriteLine("***** Testes com .NET 8 + GeneratedRegexAttribute + Partial Method *****");
    Console.WriteLine($"Versao do .NET em uso: {RuntimeInformation
    .FrameworkDescription} - Ambiente: {Environment.MachineName} - Kernel: {Environment
    .OSVersion.VersionString}");
    Console.WriteLine();

    var selectedDatabases = new string[] { "sqlserver", "mongodb", "postgres", "redis", "mysql" };
    foreach (var opcao in selectedDatabases)
    {
    var oldColor = Console.ForegroundColor;
    if (ValidationHelpers.IsRelationalDatabase().IsMatch(opcao))
    {
    Console.ForegroundColor = ConsoleColor.Cyan;
    Console.WriteLine($"{opcao} = alternativa valida");
    }
    else
    {
    Console.ForegroundColor = ConsoleColor.Red;
    Console.WriteLine($"{opcao} = alternativa invalida");
    }
    Console.ForegroundColor = oldColor;
    }