public static void SetCheck(this AutomationElement element, bool isChecked) { if (isChecked) element.Check(); else element.UnCheck(); }
internal static void CheckForRecursiveCalls(this CyclicDependencyValidator validator) { if (validator != null) { validator.Check(); } }
/// <summary> /// Computes the average of a sequence of TimeSpan objects /// </summary> /// <param name="spans">A sequence of values to calculate the average of</param> /// <returns>The average of the sequence of values</returns> public static TimeSpan Average(this IEnumerable<TimeSpan> Spans) { double ticks = 0; Spans.Check(Enumerable.Empty<TimeSpan>()); if (Spans.Any()) ticks = Spans.Average(a => a.Ticks); return new TimeSpan((long)ticks); }
public static void CheckAndAct(this ITriggerCollection triggers) { var bundles = triggers.Check(); var actions = bundles.SelectMany(x => x.Actions); foreach (var action in actions) { action.Action(); } }
public static void NotEmpty( this IValidationSetup<string> setup, bool allowWhitespaces = false ) { setup.Check( v => { if( allowWhitespaces ) { return !string.IsNullOrEmpty( v ); } return !string.IsNullOrWhiteSpace( v ); } ).Message( Strings.ValueMustNotBeEmpty ); }
public static void Copy(this INetworkGuestRepository repository, Network source, Network destination) { var users = repository.Get(source); foreach (var user in users) { if (!repository.Check(destination, user)) { repository.Add(destination, user); } } }
/// <summary> /// Adds the specified repository. /// </summary> /// <param name="repository">The repository.</param> /// <param name="userID">The user identifier.</param> /// <param name="topicID">The topic identifier.</param> public static void Add(this IRepository<WatchTopic> repository, int userID, int topicID) { CodeContracts.VerifyNotNull(repository, "repository"); if (repository.Check(userID, topicID).HasValue) { return; } repository.DbFunction.Query.watchtopic_add(UserID: userID, TopicID: topicID, UTCTIMESTAMP: DateTime.UtcNow); repository.FireNew(); }
public static void Check(this CellOperation operation, object systemUnderTest, Tree<Cell> memberName, Tree<Cell> expectedCell) { operation.Check(systemUnderTest, memberName, new CellTree(), expectedCell); }
public static RuleBuilder<MudObject, MudObject, CheckResult> CheckCanClose(this MudObject ThisObject) { return ThisObject.Check<MudObject, MudObject>("can close?").ThisOnly(1); }
/// <summary> /// Averages a list of TimeSpans /// </summary> /// <param name="List">List of TimeSpans</param> /// <returns>The average value</returns> public static TimeSpan Average(this IEnumerable<TimeSpan> List) { List = List.Check(new List<TimeSpan>()); return List.Any() ? new TimeSpan((long)List.Average(x => x.Ticks)) : new TimeSpan(0); }
public static RuleBuilder<MudObject, MudObject, CheckResult> CheckCanTake(this MudObject ThisObject) { return ThisObject.Check<MudObject, MudObject>("can take?").When((taker, obj) => System.Object.ReferenceEquals(obj, ThisObject)); }
public static RuleBuilder<MudObject, MudObject, MudObject, CheckResult> CheckCanPushDirection(this MudObject Object) { return Object.Check<MudObject, MudObject, MudObject>("can push direction?").When((actor, subject, link) => System.Object.ReferenceEquals(subject, Object)); }
public static RuleBuilder<MudObject, MudObject, CheckResult> CheckCanGo(this MudObject Object) { return Object.Check<MudObject, MudObject>("can go?").ThisOnly(); }
public static RuleBuilder<MudObject, MudObject, CheckResult> CheckCanDrop(this MudObject Object) { return Object.Check<MudObject, MudObject>("can drop?").ThisOnly(1); }