コード例 #1
0
 public void TestDeleteOrderAndUndo()
 {
     OrderService.OrderService service = new OrderService.OrderService();
       long numOrders = service.GetOrderCount();
       var allOrders = service.GetAllOrders();
       Order order = allOrders.ElementAt(new Random().Next(0, (int)numOrders - 1));
       RemoveOrderCommand remCommand = new RemoveOrderCommand(order);
       CommandService commandService = new CommandService();
       commandService.ExecuteCommand(remCommand);
       commandService.UndoCommand(remCommand);
       long numOrdersAfter = service.GetOrderCount();
       Assert.That(numOrdersAfter, Is.EqualTo(numOrders));
       Repositiory.Close(Common.Util.GetContextId());
 }
コード例 #2
0
        public void TestDeleteOrderAndUndoUsingWCFAsync()
        {
            NotificationHandler handler = new NotificationHandler();
              InstanceContext cntx = new InstanceContext(handler);
              SubscriptionServiceReference.SubscriptionServiceClient proxy = new OrderProcessing.Tests.SubscriptionServiceReference.SubscriptionServiceClient(cntx);
              proxy.Subscribe();

              string contextId = Guid.NewGuid().ToString();
              CommanndServiceReference.CommandServiceClient commandClient = new OrderProcessing.Tests.CommanndServiceReference.CommandServiceClient();
              OrderQueryServiceReference.OrderQueryServiceClient service = new OrderProcessing.Tests.OrderQueryServiceReference.OrderQueryServiceClient();

              //Common.Util.SetContextId(commandClient.InnerChannel, contextId);
              AssignContextId(commandClient.InnerChannel, contextId);
              AssignContextId(service.InnerChannel, contextId);
              //Common.Util.SetContextId(service.InnerChannel, contextId);

              long numOrders = service.Count();
              var allOrders = service.All();
              Order order = allOrders.ElementAt(new Random().Next(0, (int)numOrders - 1));
              RemoveOrderCommand remCommand = new RemoveOrderCommand(order);
              //commandClient.BeginExecuteCommand(remCommand, ar => {}, null);
              commandClient.ExecuteCommand(remCommand);
              commandClient.UndoCommand(remCommand);
              long numOrdersAfter = service.Count();
              Assert.That(numOrdersAfter, Is.EqualTo(numOrders));
        }
コード例 #3
0
 private void DeleteOrder(Order order)
 {
     ICommand command = new RemoveOrderCommand(order);
       RunCommand(command);
       ShowDataInGrid(false, "");
 }