public async Task UpdateNutrientReturnsNullIfNutrientDoesNotExist() { // Given UpdateNutrientModel model = ModelFactory.UpdateModel(Guid.NewGuid()); // When Nutrient nutrient = await _commands.Update(model); // Then nutrient.Should().BeNull(); }
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(); }
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"); }