using System; using System.Collections.Generic; using CtrEditor.ObjetosSim; using CtrEditor.ObjetosSim.HydraulicComponents; using CtrEditor.HydraulicSimulator; // Este archivo es solo para verificar que la corrección funciona // Se puede eliminar después de confirmar que todo funciona bien namespace CtrEditor.Test { class TestItemsSource { static void TestTypeAssignability() { // Crear instancias de objetos hidráulicos var pipe = new osHydPipe(); var tank = new osHydDischargeTank(); var pump = new osHydPump(); var hydTank = new osHydTank(); // Probar la corrección - debería ser true para todos Console.WriteLine($"osHydPipe implements IHydraulicComponent: {typeof(IHydraulicComponent).IsAssignableFrom(pipe.GetType())}"); Console.WriteLine($"osHydDischargeTank implements IHydraulicComponent: {typeof(IHydraulicComponent).IsAssignableFrom(tank.GetType())}"); Console.WriteLine($"osHydPump implements IHydraulicComponent: {typeof(IHydraulicComponent).IsAssignableFrom(pump.GetType())}"); Console.WriteLine($"osHydTank implements IHydraulicComponent: {typeof(IHydraulicComponent).IsAssignableFrom(hydTank.GetType())}"); // Verificar NombreCategoria y NombreClase Console.WriteLine($"osHydTank.NombreCategoria(): {osHydTank.NombreCategoria()}"); Console.WriteLine($"osHydTank.NombreClase(): {osHydTank.NombreClase()}"); // La comparación anterior que fallaba Console.WriteLine($"osHydPipe.GetType() == typeof(IHydraulicComponent): {pipe.GetType() == typeof(IHydraulicComponent)}"); Console.WriteLine($"osHydDischargeTank.GetType() == typeof(IHydraulicComponent): {tank.GetType() == typeof(IHydraulicComponent)}"); Console.WriteLine($"osHydPump.GetType() == typeof(IHydraulicComponent): {pump.GetType() == typeof(IHydraulicComponent)}"); Console.WriteLine($"osHydTank.GetType() == typeof(IHydraulicComponent): {hydTank.GetType() == typeof(IHydraulicComponent)}"); } } }