コード例 #1
0
        public void GetOrdersByName_Not_Null()
        {
            //Arrange
            var person = new RangeOfValues();

            //Act

            //Assert
            //Looks at the otuput of the if statement in the method
            Assert.Throws <ArgumentException>(() => person.GetOrdersByName(null));
        }
コード例 #2
0
        public void GetOrdersByName_Capture_Return_Message_When_Error_Is_Thrown()
        {
            //Arrange
            var person = new RangeOfValues();

            //Act

            //Assert
            //Looks at the otuput of the if statement in the method
            //sets the exception to the var below
            var exceptionDetails = Assert.Throws <ArgumentException>(() => person.GetOrdersByName(null));

            //Does the exception Message return hello
            Assert.Equal("Hello", exceptionDetails.Message);
        }