/// <summary>
 /// Validate all command parameters.
 /// </summary>
 protected override void ValidateParameters()
 {
     ArgumentAssert.IsNotEmpty <string>(Documents, "Documents");
     ArgumentAssert.IsNotEmpty <string>(Keywords, "Keywords");
     ArgumentAssert.IsNotEmpty(Index, "Index");
     ArgumentAssert.IsNotNull(BeforeMatch, "BeforeMatch");
     ArgumentAssert.IsNotNull(AfterMatch, "AfterMatch");
     ArgumentAssert.IsNotNull(SnippetsDelimiter, "SnippetsDelimiter");
     ArgumentAssert.IsGreaterThan(SnippetSizeLimit, 0, "SnippetSizeLimit");
     ArgumentAssert.IsGreaterOrEqual(SnippetsCountLimit, 0, "SnippetsCountLimit");
     ArgumentAssert.IsGreaterOrEqual(WordsAroundKeyword, 0, "WordsAroundKeyword");
     ArgumentAssert.IsGreaterOrEqual(WordsCountLimit, 0, "WordsCountLimit");
     ArgumentAssert.IsDefinedInEnum(typeof(HtmlStripMode), HtmlStripMode, "HtmlStripMode");
     ArgumentAssert.IsDefinedInEnum(typeof(PassageBoundary), PassageBoundary, "PassageBoundary");
     ArgumentAssert.IsDefinedInEnum(typeof(BuildExcerptsOptions), Options, "Options");
 }
        public void IsGreaterOrEqualTestDateTime()
        {
            string argumentName = string.Empty;
            // equal
            DateTime value = new DateTime(2000, 1, 1, 1, 1, 1);

            try
            {
                ArgumentAssert.IsGreaterOrEqual(value, new DateTime(2000, 1, 1, 1, 1, 1), argumentName);
            }
            catch (Exception ex)
            {
                Assert.Fail("Assert method must throw no exceptions.\n" + ex.Message);
            }
            // greater
            value = new DateTime(1900, 1, 1, 1, 1, 1);
            try
            {
                ArgumentAssert.IsGreaterOrEqual(value, new DateTime(1900, 1, 1, 1, 1, 0), argumentName);
            }
            catch (Exception ex)
            {
                Assert.Fail("Assert method must throw no exceptions.\n" + ex.Message);
            }
            // incorrect
            value = new DateTime(1950, 1, 1, 1, 1, 1);
            try
            {
                ArgumentAssert.IsGreaterOrEqual(value, new DateTime(1970, 1, 1, 1, 1, 1), argumentName);
                Assert.Fail("Assert method must throw ArgumentOutOfRangeException exception.");
            }
            catch (ArgumentOutOfRangeException)
            {
                // test passed
            }
        }
        public void IsGreaterOrEqualTestDouble()
        {
            string argumentName = string.Empty;
            // equal
            double value = 0;

            try
            {
                ArgumentAssert.IsGreaterOrEqual(value, 0, argumentName);
            }
            catch (Exception ex)
            {
                Assert.Fail("Assert method must throw no exceptions.\n" + ex.Message);
            }
            // greater
            value = 1;
            try
            {
                ArgumentAssert.IsGreaterOrEqual(value, 0, argumentName);
            }
            catch (Exception ex)
            {
                Assert.Fail("Assert method must throw no exceptions.\n" + ex.Message);
            }
            // incorrect
            value = 1;
            try
            {
                ArgumentAssert.IsGreaterOrEqual(value, 2, argumentName);
                Assert.Fail("Assert method must throw ArgumentOutOfRangeException exception.");
            }
            catch (ArgumentOutOfRangeException)
            {
                // test passed
            }
        }