From 70010884a3c5c6f9be2671dc02fa273721cf6505 Mon Sep 17 00:00:00 2001 From: Antony Male Date: Tue, 11 Mar 2014 13:52:44 +0000 Subject: [PATCH] Actually test that EventAggregator doesn't retain its target --- StyletUnitTests/EventAggregatorTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/StyletUnitTests/EventAggregatorTests.cs b/StyletUnitTests/EventAggregatorTests.cs index 4b0d4ff..d76b721 100644 --- a/StyletUnitTests/EventAggregatorTests.cs +++ b/StyletUnitTests/EventAggregatorTests.cs @@ -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); } } }