Beispiel #1
0
        public async Task UpdateNutrientReturnsNullIfNutrientDoesNotExist()
        {
            // Given
            UpdateNutrientModel model = ModelFactory.UpdateModel(Guid.NewGuid());

            // When
            Nutrient nutrient = await _commands.Update(model);

            // Then
            nutrient.Should().BeNull();
        }
Beispiel #2
0
        public async Task DeleteNutrientSucceeds()
        {
            // Given
            Guid nutrientId = SeedDatabase(ModelFactory.DomainModel("Nutrient B", dosageUnits: "g"));

            // When
            await _commands.Delete(nutrientId);

            // Then
            Nutrient nutrient = await DatabaseContext.Nutrients.FindAsync(nutrientId);

            nutrient.Should().BeNull();
        }
Beispiel #3
0
        public async Task UpdateNutrientReturnsNutrientOnSuccess()
        {
            // Given
            Nutrient            nutrient   = ModelFactory.DomainModel("Nutrient B", dosageUnits: "ml");
            Guid                nutrientId = SeedDatabase(nutrient);
            UpdateNutrientModel model      = ModelFactory.UpdateModel(nutrientId);

            model.DosageUnits = "g";

            // When
            nutrient = await _commands.Update(model);

            // Then
            nutrient.Should().NotBeNull();
            nutrient.Name.Should().Be("Nutrient A");
            nutrient.DosageUnits.Should().Be("g");
        }