private void btnCancel_Click(object sender, RoutedEventArgs e)
 {
     if (booking != null)
     {
         booking.Cancel();
     }
 }
示例#2
0
        public void canceled_booking()
        {
            var view    = new MainWindow();
            var context = new BookingContext(view);

            Assert.AreEqual("New booking", view.Debug.Dequeue());
            Assert.AreEqual("New.TicketCount=0.Attendee=.", context.Debug.Dequeue());

            context.SubmitDetails("Oscar", 5);

            Assert.AreEqual("Processing Booking", view.Debug.Dequeue());
            Assert.AreEqual("Pending.TicketCount=5.Attendee=Oscar.", context.Debug.Dequeue());

            context.Cancel();

            Task.Delay(500).Wait();

            Assert.AreEqual("Processing Canceled", view.Debug.Dequeue());
            Assert.AreEqual("Closed.TicketCount=5.Attendee=Oscar.", context.Debug.Dequeue());

            AssertQueuesAreEmpty(view, context);
        }