Пример #1
0
            public void ClonesAfterStopHandlersInCorrectOrder()
            {
                var server1 = new RestServer();
                var server2 = new RestServer();
                var order   = new List <string>();

                server1.AfterStopping += rs => { order.Add("1"); };
                server1.AfterStopping += rs => { order.Add("2"); };
                server1.CloneEventHandlers(server2);
                server2.GetType().GetMethod("OnAfterStopping", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(server2, null);

                order.Count.ShouldBe(2);
                order[0].ShouldBe("1");
                order[1].ShouldBe("2");
            }