public void TestDeleteCustomerAndUndoUsingWCF() { string contextId = Guid.NewGuid().ToString(); CommanndServiceReference.CommandServiceClient cmdClient = new OrderProcessing.Tests.CommanndServiceReference.CommandServiceClient(); CustomerQueryServiceReference.CustomerQueryServiceClient custQueryClient = new OrderProcessing.Tests.CustomerQueryServiceReference.CustomerQueryServiceClient(); AssignContextId(custQueryClient.InnerChannel,contextId); AssignContextId(cmdClient.InnerChannel,contextId); var customers = custQueryClient.All(); long count = custQueryClient.Count(); Customer customer = customers.ElementAt(new Random().Next(0, (int)count - 1)); //Customer customer = customers.Where(x => x.CustomerId == "YLHWC").First(); RemoveCustomerCommand command = new RemoveCustomerCommand(customer); cmdClient.ExecuteCommand(command); cmdClient.Undo(); long countAfter = custQueryClient.Count(); Assert.That(count, Is.EqualTo(countAfter)); }
public void TestDeleteCustomerAndUndo() { OrderService.QueryService.CustomerQueryService service = new OrderService.QueryService.CustomerQueryService(); var customers = service.All(); long count = service.Count(); Customer customer = customers.ElementAt(new Random().Next(0, (int)count - 1)); RemoveCustomerCommand command = new RemoveCustomerCommand(customer); CommandService commandService = new CommandService(); commandService.ExecuteCommand(command); commandService.Undo(); long countAfter = service.Count(); Assert.That(count, Is.EqualTo(countAfter)); Repositiory.Close(Common.Util.GetContextId()); }
private void DeleteCustomer(Customer customer) { ICommand removeCommand = new RemoveCustomerCommand(customer); RunCommand(removeCommand); ShowDataInGrid(false, ""); }