mirror of https://github.com/AMT-Cheif/Stylet.git
Actually test that EventAggregator doesn't retain its target
This commit is contained in:
parent
877a9b87a4
commit
70010884a3
|
@ -79,6 +79,7 @@ namespace StyletUnitTests
|
|||
{
|
||||
var ea = new EventAggregator();
|
||||
var target = new C3();
|
||||
var weaktarget = new WeakReference(target);
|
||||
ea.Subscribe(target);
|
||||
|
||||
// Ugly, but it's the only way to test a WeakReference...
|
||||
|
@ -86,6 +87,7 @@ namespace StyletUnitTests
|
|||
GC.Collect();
|
||||
|
||||
Assert.DoesNotThrow(() => ea.Publish(new M1()));
|
||||
Assert.IsNull(weaktarget.Target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue