public void SearchHttpApiCommand()
        {
            SearchProductProjectionsCommand searchCommand         = new SearchProductProjectionsCommand(new ProductProjectionSearchParameters());
            IHttpApiCommandFactory          httpApiCommandFactory = this.clientFixture.GetService <IHttpApiCommandFactory>();
            IHttpApiCommand httpApiCommand = httpApiCommandFactory.Create(searchCommand);

            Assert.Equal(typeof(SearchHttpApiCommand <ProductProjection>), httpApiCommand.GetType());
        }
        public void CreateHttpApiCommand()
        {
            CreateCommand <Category> createCommand         = new CreateCommand <Category>(new CategoryDraft());
            IHttpApiCommandFactory   httpApiCommandFactory = this.clientFixture.GetService <IHttpApiCommandFactory>();
            IHttpApiCommand          httpApiCommand        = httpApiCommandFactory.Create(createCommand);

            Assert.Equal(typeof(CreateHttpApiCommand <Category>), httpApiCommand.GetType());
        }
Example #3
0
        public void GetShippingMethodsForCart()
        {
            var command = new GetShippingMethodsForCartCommand("2bafc816-4223-4ff0-ac8a-0f08a8f29fd6");

            IHttpApiCommandFactory httpApiCommandFactory = this.clientFixture.GetService <IHttpApiCommandFactory>();
            IHttpApiCommand        httpApiCommand        = httpApiCommandFactory.Create(command);

            HttpRequestMessage httpRequestMessage = httpApiCommand.HttpRequestMessage;

            Assert.Equal(HttpMethod.Get, httpRequestMessage.Method);
            Assert.Equal("shipping-methods/matching-cart?cartId=2bafc816-4223-4ff0-ac8a-0f08a8f29fd6", httpRequestMessage.RequestUri.ToString());
        }
Example #4
0
        public void InStoreCartQueryRequest()
        {
            var command = new QueryCommand <Cart>().InStore("storeKey");
            IHttpApiCommandFactory httpApiCommandFactory = this.clientFixture.GetService <IHttpApiCommandFactory>();
            IHttpApiCommand        httpApiCommand        = httpApiCommandFactory.Create(command);

            HttpRequestMessage httpRequestMessage = httpApiCommand.HttpRequestMessage;

            Assert.Equal(HttpMethod.Get, httpRequestMessage.Method);
            Assert.Equal("in-store/key=storeKey/carts?withTotal=false", httpRequestMessage.RequestUri.ToString());

            Assert.Equal(typeof(InStoreHttpApiCommand <PagedQueryResult <Cart> >), httpApiCommand.GetType());
        }
Example #5
0
        public void InStoreCustomerInStoreSignInRequest()
        {
            var command = new LoginCustomerCommand("*****@*****.**", "password").InStore("storeKey");

            IHttpApiCommandFactory httpApiCommandFactory = this.clientFixture.GetService <IHttpApiCommandFactory>();
            IHttpApiCommand        httpApiCommand        = httpApiCommandFactory.Create(command);

            HttpRequestMessage httpRequestMessage = httpApiCommand.HttpRequestMessage;

            Assert.Equal(HttpMethod.Post, httpRequestMessage.Method);
            Assert.Equal("in-store/key=storeKey/login", httpRequestMessage.RequestUri.ToString());

            Assert.Equal(typeof(InStoreHttpApiCommand <SignInResult <Customer> >), httpApiCommand.GetType());
        }
Example #6
0
        public void InStoreCartByIdRequest()
        {
            var command = new GetByIdCommand <Cart>("2bafc816-4223-4ff0-ac8a-0f08a8f29fd6").InStore("storeKey");

            IHttpApiCommandFactory httpApiCommandFactory = this.clientFixture.GetService <IHttpApiCommandFactory>();
            IHttpApiCommand        httpApiCommand        = httpApiCommandFactory.Create(command);

            HttpRequestMessage httpRequestMessage = httpApiCommand.HttpRequestMessage;

            Assert.Equal(HttpMethod.Get, httpRequestMessage.Method);
            Assert.Equal("in-store/key=storeKey/carts/2bafc816-4223-4ff0-ac8a-0f08a8f29fd6", httpRequestMessage.RequestUri.ToString());

            Assert.Equal(typeof(InStoreHttpApiCommand <Cart>), httpApiCommand.GetType());
        }
 public InStoreHttpApiCommand(InStoreCommand <T> inStoreDecoratorCommand, IHttpApiCommandFactory factory)
 {
     this.storeKey = inStoreDecoratorCommand.StoreKey;
     this.command  = factory.Create(inStoreDecoratorCommand.InnerCommand);
 }