public void QuantityWithNoUnit_ThrowsException() { // arrange isolation // arrange test var food = new Core.Models.Food(); var exception = default(Exception); // act try { food.Quantity = new MeasuredAmount { Quantity = 0, Unit = null, }; } catch (InvalidDataException ex) { exception = ex; } // assert exception.Should().NotBeNull(); }
public void EmptyName_ThrowsException() { // arrange isolation // arrange test var food = new Core.Models.Food(); // act var exception = Assert.Throws <InvalidDataException>(() => { food.Name = default(string); }); // assert exception.Message.Should().Be(expected: "The Food Name cannot be empty."); // clean-up }
public void EmptyQuantity_ThrowsException() { // arrange isolation // arrange test var food = new Core.Models.Food(); var exception = default(Exception); // act try { food.Quantity = null; } catch (InvalidDataException ex) { exception = ex; } // assert exception.Should().NotBeNull(); }