public async Task AddStoreNoIdPathValue() { var client = await GetAdminClientAsync(); var pet = new AddStoreCommand { Name = "Mi Tiendita" }; var content = Utilities.GetRequestContent(pet); var response = await client.PostAsync("/api/Store/Add", content); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); }
public async Task AddStoreExcededNameLenghtByAdminBadRequest() { var client = await GetAdminClientAsync(); var pet = new AddStoreCommand { Name = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", IdPath = 1 }; var content = Utilities.GetRequestContent(pet); var response = await client.PostAsync("/api/Store/Add", content); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); }
public async Task AddStoreByUserUnhautorized() { var client = await GetUserClientAsync(); var pet = new AddStoreCommand { Name = "Mi Tiendita", IdPath = 1 }; var content = Utilities.GetRequestContent(pet); var response = await client.PostAsync("/api/Store/Add", content); Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); }
public async Task AddStoreSucessful() { var client = await GetAdminClientAsync(); var pet = new AddStoreCommand { IdPath = 1, Name = "tienda" }; var content = Utilities.GetRequestContent(pet); var response = await client.PostAsync("/api/Store/Add", content); response.EnsureSuccessStatusCode(); var result = await Utilities.GetResponseContent <AddStoreResponse>(response); Assert.IsType <AddStoreResponse>(result); }
public ActionResult Add(AddStoreCommand input) { return(TryPush(input)); }
public void Setup() { MockJsonTreeDB.Clear(); Command = new AddStoreCommand(); Command.SetFactory(new MockJsonTreeDBFactory()); }
public async Task <ActionResult <AddStoreResponse> > Add([FromBody] AddStoreCommand command) { return(Ok(await Mediator.Send(command))); }