Ripulata cartella progetto
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
using CredentialManager.Data;
|
||||
using CredentialManager.Models;
|
||||
using CredentialManager.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
Console.WriteLine("🧪 Testing SourceDatabaseName retrieval from credentials...");
|
||||
|
||||
// Configurazione del database temporaneo
|
||||
var options = new DbContextOptionsBuilder<CredentialDbContext>()
|
||||
.UseSqlite("Data Source=test_credential_db.db")
|
||||
.Options;
|
||||
|
||||
using var context = new CredentialDbContext(options);
|
||||
await context.Database.EnsureCreatedAsync();
|
||||
|
||||
var credentialService = new CredentialService(context);
|
||||
|
||||
// Test 1: Crea una credenziale database con nome database
|
||||
var testCredential = new DatabaseCredential
|
||||
{
|
||||
Name = "TestDatabaseCredential",
|
||||
DatabaseType = "SqlServer",
|
||||
Host = "localhost",
|
||||
Port = 1433,
|
||||
DatabaseName = "MyProductionDB",
|
||||
Username = "testuser",
|
||||
Password = "testpassword"
|
||||
};
|
||||
|
||||
Console.WriteLine($"📝 Creando credenziale con DatabaseName: {testCredential.DatabaseName}");
|
||||
var credentialId = await credentialService.SaveDatabaseCredentialAsync(testCredential);
|
||||
Console.WriteLine($"✅ Credenziale salvata con ID: {credentialId}");
|
||||
|
||||
// Test 2: Recupera la credenziale
|
||||
var retrievedCredential = await credentialService.GetDatabaseCredentialAsync(credentialId);
|
||||
Console.WriteLine($"✅ Credenziale recuperata: {retrievedCredential?.Name}");
|
||||
Console.WriteLine($" DatabaseName: {retrievedCredential?.DatabaseName}");
|
||||
|
||||
// Test 3: Simula il recupero del database name come farebbe ProfileSaver
|
||||
if (retrievedCredential != null && !string.IsNullOrEmpty(retrievedCredential.DatabaseName))
|
||||
{
|
||||
Console.WriteLine($"✅ SUCCESSO: DatabaseName recuperato dalle credenziali: {retrievedCredential.DatabaseName}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("❌ ERRORE: DatabaseName non recuperato dalle credenziali");
|
||||
}
|
||||
|
||||
// Pulizia
|
||||
await context.Database.EnsureDeletedAsync();
|
||||
Console.WriteLine("🧹 Database temporaneo eliminato");
|
||||
|
||||
Console.WriteLine("\n🎯 Test completato con successo!");
|
||||
@@ -1,15 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CredentialManager\CredentialManager.csproj" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user