Example #1
0
 public void CheckForNotEmptyStringShouldThrowArgumentNullExceptionWithWhiteSpace()
 {
     Assert.Throws <NullReferenceException>(() =>
     {
         CommonValidator.CheckForNotWhiteSpaceString("      ");
     });
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseDataProviderTestBuilder"/> class.
 /// </summary>
 /// <param name="testContext"><see cref="ControllerTestContext"/> containing data about the currently executed assertion chain.</param>
 /// <param name="dataProviderName">Name of the data provider.</param>
 protected BaseDataProviderTestBuilder(ControllerTestContext testContext, string dataProviderName)
     : base(testContext)
 {
     CommonValidator.CheckForNotWhiteSpaceString(dataProviderName);
     this.DataProviderName = dataProviderName;
     this.DataProvider     = this.GetDataProvider();
     CommonValidator.CheckForNullReference(this.DataProvider);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DataProviderEntryTestBuilder"/> class.
        /// </summary>
        /// <param name="testContext"><see cref="ComponentTestContext"/> containing data about the currently executed assertion chain.</param>
        /// <param name="dataProviderName">Data provider name.</param>
        public DataProviderEntryTestBuilder(
            ComponentTestContext testContext,
            string dataProviderName)
            : base(testContext)
        {
            CommonValidator.CheckForNotWhiteSpaceString(dataProviderName);
            this.dataProviderName = dataProviderName;

            this.validations = new List <Action <object> >();
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseAttributeTestBuilder{TAttribute}"/> class.
        /// </summary>
        /// <param name="testContext"><see cref="ComponentTestContext"/> containing data about the currently executed assertion chain.</param>
        /// <param name="attributeName">Attribute name to use in case of failed validation.</param>
        /// <param name="failedValidationAction">Action to call in case of failed validation.</param>
        protected BaseAttributeTestBuilder(
            ComponentTestContext testContext,
            string attributeName,
            Action <string, string> failedValidationAction)
            : base(testContext)
        {
            CommonValidator.CheckForNullReference(failedValidationAction, nameof(failedValidationAction));
            CommonValidator.CheckForNotWhiteSpaceString(attributeName);

            this.attributeName = attributeName;

            this.FailedValidationAction = failedValidationAction;

            this.Validations = new List <Action <TAttribute, TAttribute> >();
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseDataProviderTestBuilder"/> class.
 /// </summary>
 /// <param name="testContext"><see cref="ComponentTestContext"/> containing data about the currently executed assertion chain.</param>
 /// <param name="dataProviderName">Name of the data provider.</param>
 protected BaseDataProviderTestBuilder(ComponentTestContext testContext, string dataProviderName)
     : base(testContext)
 {
     CommonValidator.CheckForNotWhiteSpaceString(dataProviderName);
     this.DataProviderName = dataProviderName;
 }
 public void CheckForNotEmptyStringShouldNotThrowExceptionWithNormalString()
 {
     CommonValidator.CheckForNotWhiteSpaceString(new string('a', 10));
 }
Example #7
0
 public void CheckForNotEmptyStringShouldThrowArgumentNullExceptionWithWhiteSpace()
 {
     CommonValidator.CheckForNotWhiteSpaceString("      ");
 }