Exemplo n.º 1
0
        public async Task <IActionResult> CreateIngrediantAsync([FromBody] string model)
        {
            var result = await _service.AddAsync(model);

            result.Url = this.Url.RouteUrl("GetIngrediantById", new { id = result.Id });
            return(CreatedAtRoute("GetIngrediantById", new { id = result.Id }, result));
        }
Exemplo n.º 2
0
        public async Task AddIngrediant()
        {
            await InitializeAsync();

            var newIngrediant = "New Ingrediant";

            using (IIngrediantService service = GetService())
            {
                var output = await service.AddAsync(newIngrediant);

                Assert.NotNull(output);
                Assert.NotEqual(0, output.Id);
                Assert.Equal(this.TestData.Ingrediants.Count + 1, this.DbContext.Ingrediants.Count());
            }
        }