private static HttpResponseMessage ExecuteRequestReturnResponse()
        {
            var orderForm = new OrderForm(DefaultUriFactory.Instance, DummyQuotationEngine.Instance);

            var request = new HttpRequestMessage {RequestUri = DefaultUriFactory.Instance.CreateAbsoluteUri<OrderForm>(BaseAddress, DummyQuotationEngine.QuoteId)};
            return orderForm.Get(DummyQuotationEngine.QuoteId, request);
        }
 public void ShouldReturn404NotFoundWhenGettingOrderFormThatDoesNotExist()
 {
     try
     {
         var orderForm = new OrderForm(DefaultUriFactory.Instance, EmptyQuotationEngine.Instance);
         orderForm.Get(Guid.NewGuid().ToString("N"), new HttpRequestMessage());
         Assert.Fail();
     }
     catch (HttpResponseException ex)
     {
         Assert.AreEqual(HttpStatusCode.NotFound, ex.Response.StatusCode);
     }
 }
        private static Shop ExecuteRequestReturnEntityBody()
        {
            var orderForm = new OrderForm(DefaultUriFactory.Instance, DummyQuotationEngine.Instance);

            var request = new HttpRequestMessage {RequestUri = DefaultUriFactory.Instance.CreateAbsoluteUri<OrderForm>(BaseAddress, DummyQuotationEngine.QuoteId)};
            var response = orderForm.Get(DummyQuotationEngine.QuoteId, request);

            return response.Content.ReadAsOrDefault();
        }
        public void ShouldBaseOrderFormOnQuoteFromQuoteEngine()
        {
            var mockQuoteEngine = MockRepository.GenerateMock<IQuotationEngine>();

            var id = Guid.NewGuid();

            var quote = new Quotation(
                Guid.Empty,
                DateTime.Now,
                new[]
                    {
                        new LineItem("item1", new Quantity("g", 250), new Money("GBP", 2.50)),
                        new LineItem("item2", new Quantity("kg", 2), new Money("GBP", 2.00))
                    });

            mockQuoteEngine.Expect(q => q.GetQuote(id)).Return(quote);

            var request = new HttpRequestMessage {RequestUri = DefaultUriFactory.Instance.CreateAbsoluteUri<OrderForm>(BaseAddress, id)};

            var orderForm = new OrderForm(DefaultUriFactory.Instance, mockQuoteEngine);
            var response = orderForm.Get(id.ToString("N"), request);

            var entityBody = response.Content.ReadAsOrDefault();

            Assert.True(entityBody.HasForms);
            Assert.True(entityBody.Forms.First().Instance.HasItems);
            Assert.True(Matching.LineItemsMatchItems(quote.LineItems, entityBody.Forms.First().Instance.Items));

            mockQuoteEngine.VerifyAllExpectations();
        }