public void TestComputePrice()
        {
            #region Test #1: Computation of Price Near Expiry

            // Instantiate a Caplet that has an expiry less than one day.
            _optionType       = BlackCapletFlooret.OptionType.Caplet;
            _notional         = 1.0E+08d;
            _optionExpiry     = 1.36986E-03d;
            _strike           = 7.50d / 100d;
            _tau              = 0.25205d;
            _capletFlooretObj = new BlackCapletFlooret
                                    (_notional,
                                    _optionExpiry,
                                    _optionType,
                                    _strike,
                                    _tau,
                                    _validateArguments);

            Assert.IsNotNull(_capletFlooretObj);

            // Price the Caplet.
            _discountFactor = 0.99617d;
            _forwardRate    = 8.53100d / 100d;
            _sigma          = 9.43000d / 100d;
            _actual         = _capletFlooretObj.ComputePrice
                                  (_discountFactor,
                                  _forwardRate,
                                  _sigma,
                                  _validateArguments);
            _expected = 258868.27d;
            Assert.AreEqual(_expected,
                            _actual,
                            _tolerance);

            #endregion

            #region Test #2: Computation of a Caplet Price

            _optionType       = BlackCapletFlooret.OptionType.Caplet;
            _notional         = 1.0E+08d;
            _optionExpiry     = 0.50959d;
            _strike           = 7.50d / 100d;
            _tau              = 0.25205d;
            _capletFlooretObj = new BlackCapletFlooret
                                    (_notional,
                                    _optionExpiry,
                                    _optionType,
                                    _strike,
                                    _tau,
                                    _validateArguments);

            Assert.IsNotNull(_capletFlooretObj);

            // Price the Caplet.
            _discountFactor = 0.94617d;
            _forwardRate    = 7.43100d / 100d;
            _sigma          = 9.43000d / 100d;
            _actual         = _capletFlooretObj.ComputePrice
                                  (_discountFactor,
                                  _forwardRate,
                                  _sigma,
                                  _validateArguments);
            _expected  = 40027.17d;
            _tolerance = 2.0d;
            Assert.AreEqual(_expected,
                            _actual,
                            _tolerance);

            #endregion

            #region Test #3: Computation of a Flooret Price

            _optionType       = BlackCapletFlooret.OptionType.Flooret;
            _notional         = 1.0E+08d;
            _optionExpiry     = 0.50959d;
            _strike           = 7.50d / 100d;
            _tau              = 0.25205d;
            _capletFlooretObj = new BlackCapletFlooret
                                    (_notional,
                                    _optionExpiry,
                                    _optionType,
                                    _strike,
                                    _tau,
                                    _validateArguments);

            Assert.IsNotNull(_capletFlooretObj);

            // Price the Flooret.
            _discountFactor = 0.94617d;
            _forwardRate    = 7.43100d / 100d;
            _sigma          = 9.43000d / 100d;
            _actual         = _capletFlooretObj.ComputePrice
                                  (_discountFactor,
                                  _forwardRate,
                                  _sigma,
                                  _validateArguments);
            _expected  = 56482.43d;
            _tolerance = 2.0d;
            Assert.AreEqual(_expected,
                            _actual,
                            _tolerance);

            #endregion
        }
        public void TestComputePriceDataValidation()
        {
            #region Test that an Incorrect Discount Factor is Detected

            try
            {
                Initialisation();
                _discountFactor = 0d;
                _capletFlooretObj.ComputePrice(_discountFactor,
                                               _forwardRate,
                                               _sigma,
                                               _validateArguments);
            }
            catch (ArgumentException e)
            {
                const string ErrorMessage =
                    "Discount factor used to price a Caplet/Flooret must be positive";

                Assert.AreEqual(ErrorMessage, e.Message);
            }

            #endregion

            #region Test that an Incorrect Forward Rate is Detected

            try
            {
                Initialisation();
                _forwardRate = 0d;
                _capletFlooretObj.ComputePrice(_discountFactor,
                                               _forwardRate,
                                               _sigma,
                                               _validateArguments);
            }
            catch (ArgumentException e)
            {
                const string ErrorMessage =
                    "Forward rate used to price a Caplet/Flooret must be positive";

                Assert.AreEqual(ErrorMessage, e.Message);
            }

            #endregion

            #region Test that an Incorrect Volatility is Detected

            try
            {
                Initialisation();
                _sigma = 0d;
                _capletFlooretObj.ComputePrice(_discountFactor,
                                               _forwardRate,
                                               _sigma,
                                               _validateArguments);
            }
            catch (ArgumentException e)
            {
                const string ErrorMessage =
                    "Volatility used to price a Caplet/Flooret must be positive";

                Assert.AreEqual(ErrorMessage, e.Message);
            }

            #endregion
        }