Actually test that EventAggregator doesn't retain its target

This commit is contained in:
Antony Male 2014-03-11 13:52:44 +00:00
parent 877a9b87a4
commit 70010884a3
1 changed files with 2 additions and 0 deletions

View File

@ -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);
}
}
}