33 lines
1.6 KiB
C#
33 lines
1.6 KiB
C#
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();
|
|
|
|
// 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())}");
|
|
|
|
// 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)}");
|
|
}
|
|
}
|
|
}
|