public void Succeed_NullString() { const string s = null; var result = ArgumentUtility.CheckNotEmpty("arg", s); Assert.That(result, Is.Null); }
/// <summary> /// Creates a <see cref="CommandInfo"/> for a postback-based command. /// </summary> /// <param name="title">The <see cref="string"/> displayed as the commands title. Must not be empty.</param> /// <param name="accessKey">The <see cref="char"/> to use for keyboard-shortcut navigation.</param> /// <param name="onClick">The javascript hooked up to the click event. Must not be <see langword="null" /> or empty.</param> public static CommandInfo CreateForPostBack(string title, string accessKey, string onClick) { ArgumentUtility.CheckNotEmpty("title", title); ArgumentUtility.CheckNotNullOrEmpty("onClick", onClick); return(new CommandInfo(title, accessKey, "#", null, onClick)); }
public SqlRowNumberExpression(Ordering[] orderings) { ArgumentUtility.CheckNotNull("orderings", orderings); ArgumentUtility.CheckNotEmpty("orderings", orderings); _orderings = Array.AsReadOnly(orderings); }
public SqlIndexDefinition( string indexName, IEnumerable <SqlIndexedColumnDefinition> columns, IEnumerable <ColumnDefinition> includedColumns = null, bool?isClustered = false, bool?isUnique = false, bool?ignoreDupKey = null, bool?online = null, bool?padIndex = null, int?fillFactor = null, bool?sortInTempDb = null, bool?statisticsNoReCompute = null, bool?dropExisting = null, bool?allowRowLocks = null, bool?allowPageLocks = null, int?maxDop = null) : base(padIndex, fillFactor, sortInTempDb, statisticsNoReCompute, dropExisting, allowRowLocks, allowPageLocks, maxDop) { ArgumentUtility.CheckNotNullOrEmpty("indexName", indexName); ArgumentUtility.CheckNotNullOrEmpty("columns", columns); ArgumentUtility.CheckNotEmpty("includedColumns", includedColumns); _indexName = indexName; _columns = columns.ToList().AsReadOnly(); if (includedColumns != null) { _includedColumns = includedColumns.ToList().AsReadOnly(); } _isClustered = isClustered; _isUnique = isUnique; _ignoreDupKey = ignoreDupKey; _online = online; }
public void Succeed_NonEmptyGuid() { Guid guid = Guid.NewGuid(); var result = ArgumentUtility.CheckNotEmpty("arg", guid); Assert.That(result, Is.EqualTo(guid)); }
public EntityNameDefinition(string schemaName, string entityName) { ArgumentUtility.CheckNotEmpty("schemaName", schemaName); ArgumentUtility.CheckNotNullOrEmpty("entityName", entityName); _schemaName = schemaName; _entityName = entityName; }
/// <summary> /// Initializes a new instance of the <see cref="SecurityPrincipalRole"/> type. /// </summary> /// <param name="group">The group the user is a member of when he is this role. Must not be <see langword="null" /> or empty.</param> /// <param name="position">The position in the <paramref name="group"/>. Must not be empty.</param> public SecurityPrincipalRole(string group, string position) { ArgumentUtility.CheckNotNullOrEmpty("group", group); ArgumentUtility.CheckNotEmpty("position", position); _group = group; _position = position; }
public DomainPropertyControlSelectionCommandBuilder([NotNull] string domainProperty, [CanBeNull] string domainClass = null) { ArgumentUtility.CheckNotNullOrEmpty("domainProperty", domainProperty); ArgumentUtility.CheckNotEmpty("domainClass", domainClass); _domainProperty = domainProperty; _domainClass = domainClass; }
/// <summary> /// Creates a <see cref="CommandInfo"/> for a hyperlink-based command. /// </summary> /// <param name="title">The text displayed as the command's title. Must not be empty.</param> /// <param name="accessKey">The <see cref="char"/> to use for keyboard-shortcut navigation.</param> /// <param name="href">The url to be opened when the command is clicked. Must not be <see langword="null" /> or empty.</param> /// <param name="target">The target where the url is opened. Must not be empty.</param> /// <param name="onClick">An optional javascript hooked up to the click event. The script is only allowed to do housekeeping. Must not be empty.</param> public static CommandInfo CreateForLink(string title, string accessKey, string href, string target, string onClick) { ArgumentUtility.CheckNotEmpty("title", title); ArgumentUtility.CheckNotNullOrEmpty("href", href); ArgumentUtility.CheckNotEmpty("target", target); ArgumentUtility.CheckNotEmpty("onClick", onClick); return(new CommandInfo(title, accessKey, href, target, onClick)); }
public DomainPropertyControlSelectionCommand( [NotNull] IDomainPropertyControlSelector <TControlObject> controlSelector, [NotNull] string domainProperty, [CanBeNull] string domainClass = null) { ArgumentUtility.CheckNotNull("controlSelector", controlSelector); ArgumentUtility.CheckNotNullOrEmpty("domainProperty", domainProperty); ArgumentUtility.CheckNotEmpty("domainClass", domainClass); _controlSelector = controlSelector; _domainProperty = domainProperty; _domainClass = domainClass; }
/// <summary> /// Extension method for selecting a control by the domain property it represetns (using the /// <see cref="DomainPropertyControlSelectionCommandBuilder{TControlSelector,TControlObject}"/>). /// </summary> public static TControlObject ByDomainProperty <TControlSelector, TControlObject> ( [NotNull] this IFluentControlSelector <TControlSelector, TControlObject> fluentControlSelector, [NotNull] string domainProperty, [CanBeNull] string domainClass = null) where TControlSelector : IDomainPropertyControlSelector <TControlObject> where TControlObject : ControlObject { ArgumentUtility.CheckNotNull("fluentControlSelector", fluentControlSelector); ArgumentUtility.CheckNotNullOrEmpty("domainProperty", domainProperty); ArgumentUtility.CheckNotEmpty("domainClass", domainClass); return(fluentControlSelector.GetControl( new DomainPropertyControlSelectionCommandBuilder <TControlSelector, TControlObject> (domainProperty, domainClass))); }
public SecurityPrincipal(string user, ISecurityPrincipalRole role, string substitutedUser, ISecurityPrincipalRole substitutedRole) { ArgumentUtility.CheckNotNullOrEmpty("user", user); ArgumentUtility.CheckNotEmpty("substitutedUser", substitutedUser); if (substitutedRole != null && substitutedUser == null) { throw new ArgumentException("The substituted user must be specified if a substituted role is also specified.", "substitutedUser"); } _user = user; _substitutedRole = substitutedRole; _substitutedUser = substitutedUser; _role = role; }
public UnionViewDefinition( StorageProviderDefinition storageProviderDefinition, EntityNameDefinition viewName, IEnumerable <IRdbmsStorageEntityDefinition> unionedEntities, ObjectIDStoragePropertyDefinition objectIDProperty, IRdbmsStoragePropertyDefinition timestampProperty, IEnumerable <IRdbmsStoragePropertyDefinition> dataProperties, IEnumerable <IIndexDefinition> indexes, IEnumerable <EntityNameDefinition> synonyms) : base( storageProviderDefinition, viewName, objectIDProperty, timestampProperty, dataProperties, indexes, synonyms) { ArgumentUtility.CheckNotNull("unionedEntities", unionedEntities); var unionedEntitiesList = unionedEntities.ToList().AsReadOnly(); ArgumentUtility.CheckNotEmpty("unionedEntities", unionedEntitiesList); for (int i = 0; i < unionedEntitiesList.Count; ++i) { var unionedEntity = unionedEntitiesList[i]; if (!(unionedEntity is TableDefinition || unionedEntity is UnionViewDefinition)) { throw new ArgumentException( string.Format( "Item {0} is of type '{1}', but the unioned entities must either be a TableDefinitions or UnionViewDefinitions.", i, unionedEntity.GetType()), "unionedEntities"); } } _unionedEntities = unionedEntitiesList; }
private void CheckValue(string argumentName, object value) { Type valueType = value.GetType(); if (valueType != typeof(Guid) && valueType != typeof(int) && valueType != typeof(string)) { throw CreateArgumentException(argumentName, "Remotion.Data.DomainObjects.ObjectID does not support values of type '{0}'.", valueType); } if (valueType == typeof(string)) { ObjectIDStringSerializer.Instance.CheckSerializableStringValue((string)value); } if (valueType == typeof(string)) { ArgumentUtility.CheckNotEmpty(argumentName, (string)value); } if (valueType == typeof(Guid)) { ArgumentUtility.CheckNotEmpty(argumentName, (Guid)value); } }
public void SetAdditionalCssClassForDataRow(string cssClass) { ArgumentUtility.CheckNotEmpty("cssClass", cssClass); _additionalCssClassForDataRow = cssClass; }
public void Succeed_NonEmptyString() { var result = ArgumentUtility.CheckNotEmpty("arg", "x"); Assert.That(result, Is.EqualTo("x")); }
public void Fail_EmptyString() { ArgumentUtility.CheckNotEmpty("arg", ""); }
public void Fail_EmptyGuid() { ArgumentUtility.CheckNotEmpty("arg", Guid.Empty); }
public void Succeed_NonEmptyCollection() { var result = ArgumentUtility.CheckNotEmpty("arg", new[] { 1 }); Assert.That(result, Is.EqualTo(new[] { 1 })); }
public void Fail_EmptyCollection() { ArgumentUtility.CheckNotEmpty("arg", Type.EmptyTypes); }
public void Succeed_NullCollection() { var result = ArgumentUtility.CheckNotEmpty("arg", (IEnumerable)null); Assert.That(result, Is.Null); }