public async Task GetByPlantReturnsNullWhenNotFound()
        {
            // Given
            Plant plant = SeedDatabaseForGetByPlantTesting();

            // When
            AdministeredNutrient administeredNutrient = await _queries.Get(plant.Id, Guid.NewGuid());

            // Then
            administeredNutrient.Should().BeNull();
        }
        public async Task GetByPlantReturnsNullIfPlantDoesNotExist()
        {
            // Given
            Guid plantId = Guid.NewGuid();
            Guid id      = Guid.NewGuid();

            // When
            AdministeredNutrient administeredNutrient = await _queries.Get(plantId, id);

            // Then
            administeredNutrient.Should().BeNull();
        }
        public async Task GetByPlantReturnsAdministeredNutrients()
        {
            // Given
            Plant plant = SeedDatabaseForGetByPlantTesting();
            AdministeredNutrient administeredNutrient = plant.AdministeredNutrients.First();

            // When
            AdministeredNutrient administeredNutrientsFromDatabase = await _queries.Get(plant.Id, administeredNutrient.Id);

            // Then
            administeredNutrientsFromDatabase.Should().NotBeNull();
        }
        public async Task UpdateAdministeredNutrientReturnsNullIfAdministeredNutrientDoesNotExist()
        {
            // Given
            Plant plant   = Plants.ModelFactory.DomainModel();
            Guid  plantId = SeedDatabase(plant);
            UpdateAdministeredNutrientModel model = ModelFactory.UpdateModel();

            // When
            AdministeredNutrient administeredNutrient = await _commands.Update(plantId, model);

            // Then
            administeredNutrient.Should().BeNull();
        }
        public async Task DeleteAdministeredNutrientSucceeds()
        {
            // Given
            Plant plant   = Plants.ModelFactory.DomainModel();
            Guid  plantId = SeedDatabase(plant);
            AdministeredNutrient administeredNutrient = ModelFactory.DomainModel(plant: plant);
            Guid id = SeedDatabase(administeredNutrient);

            // When
            await _commands.Delete(plantId, id);

            // Then
            administeredNutrient = await DatabaseContext.AdministeredNutrients.FindAsync(id);

            administeredNutrient.Should().BeNull();
        }
        public async Task UpdateAdministeredNutrientReturnsAdministeredNutrientOnSuccess()
        {
            // Given
            Plant                plant                  = Plants.ModelFactory.DomainModel();
            Guid                 plantId                = SeedDatabase(plant);
            Nutrient             nutrient               = Tests.Nutrients.ModelFactory.DomainModel();
            Guid                 nutrientId             = SeedDatabase(nutrient);
            AdministeredNutrient administeredNutrient   = ModelFactory.DomainModel(plant: plant);
            Guid                 administeredNutrientId = SeedDatabase(administeredNutrient);

            UpdateAdministeredNutrientModel model = ModelFactory.UpdateModel(administeredNutrientId, nutrientId);

            // When
            administeredNutrient = await _commands.Update(plantId, model);

            // Then
            administeredNutrient.Should().NotBeNull();
            administeredNutrient.Id.Should().Be(administeredNutrientId);
            administeredNutrient.Plant.Id.Should().Be(plant.Id);
            administeredNutrient.Nutrient.Id.Should().Be(nutrient.Id);
        }