示例#1
0
        public async Task GetNutrientReturnsNullWhenNotFound()
        {
            // Given
            Guid nutrientId = Guid.NewGuid();

            // When
            NutrientDetailsModel nutrient = await _queries.Get(nutrientId);

            // Then
            nutrient.Should().BeNull();
        }
示例#2
0
        public async Task GetNutrientReturnsNutrientWhenFound()
        {
            // Given
            Guid nutrientId = SeedDatabaseForGetByIdTesting();

            // When
            NutrientDetailsModel nutrient = await _queries.Get(nutrientId);

            // Then
            nutrient.Should().NotBeNull();
        }
示例#3
0
        public async Task <ActionResult <NutrientDetailsViewModel> > GetNutrient(Guid id)
        {
            NutrientDetailsModel nutrient = await _queries.Get(id);

            if (nutrient is null)
            {
                return(NotFound());
            }

            return(Ok(nutrient));
        }