Exemple #1
0
        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();
        }
Exemple #2
0
        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
        }
Exemple #3
0
        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();
        }