public void ValidateCancelOrderCommand_IfOrderIdAndTraderIdIsValidAndOrderStatusIsNotCompleteOrCancelled_CommandWillBeValidated()
        {
            Order order = OrderFactory.CreateOrder("1234", "XBTUSD", "limit", "buy", 5, 10,
                                                   new StubbedOrderIdGenerator());
            OrderReadModel model = ReadModelAdapter.GetOrderReadModel(order);

            _persistanceRepository.SaveOrUpdate(model);
            CancelOrderCommand            command    = new CancelOrderCommand(order.OrderId, order.TraderId);
            ICancelOrderCommandValidation validation = new CancelOrderCommandValidation(_orderRepository);

            Assert.True(validation.ValidateCancelOrderCommand(command));
        }
        public void ValidateCancelOrderCommand_IfOrderIdAndTraderIdIsValidAndOrderStatusIsCancelled_InvalidOperationException()
        {
            Order order = OrderFactory.CreateOrder("1234", "XBTUSD", "limit", "buy", 5, 10,
                                                   new StubbedOrderIdGenerator());

            order.OrderState = OrderState.Cancelled;
            OrderReadModel model = ReadModelAdapter.GetOrderReadModel(order);

            _persistanceRepository.SaveOrUpdate(model);
            CancelOrderCommand            command    = new CancelOrderCommand(order.OrderId, order.TraderId);
            ICancelOrderCommandValidation validation = new CancelOrderCommandValidation(_orderRepository);

            validation.ValidateCancelOrderCommand(command);
        }
 public override bool IsValid()
 {
     ValidationResult = new CancelOrderCommandValidation().Validate(this);
     return(ValidationResult.IsValid);
 }