Ripulata cartella progetto

This commit is contained in:
2025-07-05 22:18:01 +02:00
parent ee3c251b08
commit 5195147a4f
8 changed files with 1 additions and 224 deletions
-62
View File
@@ -1,62 +0,0 @@
using CredentialManager.Data;
using CredentialManager.Models;
using CredentialManager.Services;
using Microsoft.EntityFrameworkCore;
Console.WriteLine("🧪 Testing SourceDatabaseName database persistence...");
// Configurazione del database temporaneo
var options = new DbContextOptionsBuilder<CredentialDbContext>()
.UseSqlite("Data Source=test_sourcedatabase.db")
.Options;
using var context = new CredentialDbContext(options);
await context.Database.EnsureCreatedAsync();
var profileService = new DataCouplerProfileService(context);
// Test: Creazione e salvataggio di un profilo con SourceDatabaseName
var testProfile = new DataCouplerProfile
{
Name = "Test Profile DB",
Description = "Test per verificare il salvataggio del SourceDatabaseName",
SourceType = "database",
SourceDatabaseName = "MyProductionDatabase",
SourceSchema = "dbo",
SourceTable = "customers",
DestinationType = "rest",
DestinationEndpoint = "/api/customers",
CreatedBy = "TestUser"
};
Console.WriteLine($"📝 Creando profilo con SourceDatabaseName: {testProfile.SourceDatabaseName}");
// Salvataggio nel database
var savedProfile = await profileService.SaveProfileAsync(testProfile);
Console.WriteLine($"✅ Profilo salvato con ID: {savedProfile.Id}");
// Recupero dal database
var retrievedProfile = await profileService.GetProfileByIdAsync(savedProfile.Id);
Console.WriteLine($"✅ Profilo recuperato dal database");
// Verifica che il SourceDatabaseName sia stato salvato e recuperato correttamente
if (retrievedProfile != null && retrievedProfile.SourceDatabaseName == testProfile.SourceDatabaseName)
{
Console.WriteLine($"✅ SUCCESSO: SourceDatabaseName salvato e recuperato correttamente: {retrievedProfile.SourceDatabaseName}");
}
else
{
Console.WriteLine($"❌ ERRORE: SourceDatabaseName non salvato correttamente");
Console.WriteLine($" Originale: {testProfile.SourceDatabaseName}");
Console.WriteLine($" Recuperato: {retrievedProfile?.SourceDatabaseName ?? "NULL"}");
}
// Test conversione DTO
var dto = profileService.ToDto(retrievedProfile!);
Console.WriteLine($"✅ DTO convertito con SourceDatabaseName: {dto.SourceDatabaseName}");
// Pulizia
await context.Database.EnsureDeletedAsync();
Console.WriteLine("🧹 Database temporaneo eliminato");
Console.WriteLine("\n🎯 Test completato con successo!");