package sqlserver import ( "testing" ) func TestSQLServer_pattern(t *testing.T) { if !pattern.Match([]byte(`builder.Services.AddDbContext(optionsBuilder => optionsBuilder.UseSqlServer("Server=localhost;Initial Catalog=master;User ID=sa;Password=P@ssw0rd!;Persist Security Info=true;MultipleActiveResultSets=true;"));`)) { t.Errorf("SQLServer.pattern: did not find connection string from Program.cs") } if !pattern.Match([]byte(`{"ConnectionStrings": {"Demo": "Server=localhost;Initial Catalog=master;User ID=sa;Password=P@ssw0rd!;Persist Security Info=true;MultipleActiveResultSets=true;"}}`)) { t.Errorf("SQLServer.pattern: did not find connection string from appsettings.json") } if !pattern.Match([]byte(`CONNECTION_STRING: Server=localhost;Initial Catalog=master;User ID=sa;Password=P@ssw0rd!;Persist Security Info=true;MultipleActiveResultSets=true`)) { t.Errorf("SQLServer.pattern: did not find connection string from .env") } if !pattern.Match([]byte(``)) { t.Errorf("SQLServer.pattern: did not find connection string in xml format") } }