예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
 public ActionResult Add(AddStoreCommand input)
 {
     return(TryPush(input));
 }
예제 #6
0
 public void Setup()
 {
     MockJsonTreeDB.Clear();
     Command = new AddStoreCommand();
     Command.SetFactory(new MockJsonTreeDBFactory());
 }
예제 #7
0
 public async Task <ActionResult <AddStoreResponse> > Add([FromBody] AddStoreCommand command)
 {
     return(Ok(await Mediator.Send(command)));
 }