public void suspend_runs_backwards() { List <object> actual = new List <object>(); List <object> expected = new List <object> () { "before3", "before2", "before1", "when3", "when2", "when1", "after3", "after2", "after1" }; lifecycle.BeforeSuspending(CreateValuePusher(actual, "before1")); lifecycle.BeforeSuspending(CreateValuePusher(actual, "before2")); lifecycle.BeforeSuspending(CreateValuePusher(actual, "before3")); lifecycle.WhenSuspending(CreateValuePusher(actual, "when1")); lifecycle.WhenSuspending(CreateValuePusher(actual, "when2")); lifecycle.WhenSuspending(CreateValuePusher(actual, "when3")); lifecycle.AfterSuspending(CreateValuePusher(actual, "after1")); lifecycle.AfterSuspending(CreateValuePusher(actual, "after2")); lifecycle.AfterSuspending(CreateValuePusher(actual, "after3")); lifecycle.Initialize(); lifecycle.Suspend(); Assert.That(actual, Is.EqualTo(expected).AsCollection); }
public IContext AfterSuspending(Action handler) { _lifecycle.AfterSuspending(handler); return(this); }