File tree Expand file tree Collapse file tree
Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Tests/Editor Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22using System . Linq ;
33using MackySoft . SerializeReferenceExtensions . Editor ;
44using NUnit . Framework ;
5+ using UnityEngine ;
56
67namespace MackySoft . SerializeReferenceExtensions . Tests
78{
@@ -39,6 +40,33 @@ public void Invariance_RemainsStrict ()
3940 Assert . That ( set , Does . Contain ( typeof ( Invariant_Actor ) ) ) ;
4041 Assert . That ( set , ! Does . Contain ( typeof ( Invariant_NetworkActor ) ) ) ;
4142 }
43+
44+ [ Test ]
45+ public void GenericClass_ParticleSystem_IsSupported ( )
46+ {
47+ var set = TypeSearchService . TypeCandiateService . GetDisplayableTypes ( typeof ( IObjectHolder < ParticleSystem > ) ) . ToHashSet ( ) ;
48+
49+ Assert . That ( set , Does . Contain ( typeof ( ObjectHolder < ParticleSystem > ) ) ) ;
50+ Assert . That ( set , Does . Contain ( typeof ( ParticleSystemHolder ) ) ) ;
51+ }
52+
53+ [ Test ]
54+ public void GenericClass_GameObject_IsSupported ( )
55+ {
56+ var set = TypeSearchService . TypeCandiateService . GetDisplayableTypes ( typeof ( IObjectHolder < GameObject > ) ) . ToHashSet ( ) ;
57+
58+ Assert . That ( set , Does . Contain ( typeof ( ObjectHolder < GameObject > ) ) ) ;
59+ Assert . That ( set , ! Does . Contain ( typeof ( ParticleSystemHolder ) ) ) ;
60+ }
61+
62+ [ Test ]
63+ public void GenericClass_Integer_IsSupported ( )
64+ {
65+ var set = TypeSearchService . TypeCandiateService . GetDisplayableTypes ( typeof ( IObjectHolder < int > ) ) . ToHashSet ( ) ;
66+
67+ Assert . That ( set , Does . Contain ( typeof ( ObjectHolder < int > ) ) ) ;
68+ Assert . That ( set , ! Does . Contain ( typeof ( ParticleSystemHolder ) ) ) ;
69+ }
4270 }
4371}
4472#endif
Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ public interface IContravariant<in T> { }
6161 public interface ICovariant < out T > { T Create ( ) ; }
6262 public interface IInvariant < T > { }
6363
64+ public interface IObjectHolder < T > { }
65+
6466 [ Serializable ]
6567 public sealed class Contravariant_Actor : IContravariant < IActor > { }
6668
@@ -93,4 +95,10 @@ public sealed class Invariant_Actor : IInvariant<IActor> { }
9395
9496 [ Serializable ]
9597 public sealed class Invariant_NetworkActor : IInvariant < INetworkActor > { }
98+
99+ [ Serializable ]
100+ public sealed class ObjectHolder < T > : IObjectHolder < T > { }
101+
102+ [ Serializable ]
103+ public sealed class ParticleSystemHolder : IObjectHolder < ParticleSystem > { }
96104}
You can’t perform that action at this time.
0 commit comments