Пример #1
0
        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);
        }
Пример #2
0
 public IContext BeforeSuspending(Action handler)
 {
     _lifecycle.BeforeSuspending(handler);
     return(this);
 }