public void AppReturnsBadRequestWhenCancelingPaidOrder()
        {
            var app = new Browser(new Bootstrapper());

              var createdResponse = CreatedOrder(app);
              var orderPath = GetOrderPath(createdResponse);

              var paymentResponse = app.Post(orderPath + "/payment/",
                                     with =>
                                     {
                                       with.HttpRequest();
                                       var xmlString = new PaymentRepresentation { CardNumber = "321", CardOwner = "Jose" }.ToXmlString();
                                       with.Body(xmlString);
                                     });
              Assert.That(paymentResponse.StatusCode, Is.EqualTo(HttpStatusCode.OK));

              var cancelResponse = app.Delete(orderPath);
              Assert.That(cancelResponse.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));
        }
Ejemplo n.º 2
0
        public void WhenOrderExist_ThenCancel()
        {
            //Arrange
              var order = new Order {Id = 123};
              var app = CreateAppProxy(new RepositoryStub<Order>(order));

              // Act
              var response = app.Post("/order/123/payment/",
                              with =>
                              {
                                with.HttpRequest();
                                var xmlString = new PaymentRepresentation {CardNumber = "321", CardOwner = "Jose"}.ToXmlString();
                                with.Body(xmlString);
                              });

              order.Status.Should().Be.EqualTo(OrderStatus.Paid);
              order.Payment.CardOwner.Should().Be.EqualTo("Jose");
              order.Payment.CreditCardNumber.Should().Be.EqualTo("321");
        }