Beispiel #1
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());
        }
 public static CommandBuilder <InStoreCommand <SignInResult <T> >, SignInResult <T> > Login <T>(
     this CommandBuilder <InStoreCommand <T>, T> builder,
     string email,
     string password)
     where T : Resource <T>
 {
     return(new CommandBuilder <InStoreCommand <SignInResult <T> >, SignInResult <T> >(
                builder.Client, () =>
     {
         var inStoreCommand = builder.Build();
         var innerCommand = new LoginCustomerCommand(email, password) as LoginCommand <T>;
         var newInStoreCommand = new InStoreCommand <SignInResult <T> >(inStoreCommand.StoreKey, innerCommand);
         return newInStoreCommand;
     }));
 }
 public async Task <ActionResult <LoginCustomerResponse> > Login([FromBody] LoginCustomerCommand account)
 => Result(await SendAsync(account));