/// <summary> /// default constructor /// </summary> public MainWindow() { InitializeComponent(); // set default year _year = DateTime.Now.Year; // create game class _game = new Game(_points); // set event hanlders _game.Message += OnMessage; _game.Budget += OnBudget; // create check class _check = new Check(); // set events _check.Attack += OnAttack; _check.Assault += OnAssault; _check.EconomyCrises += OnEconomyCrises; // change points OnChangePoints(); }
private static CheckResult RunCheckInExceptionHandler(ICheck check, IManagementClient managementClient) { try { return check.RunCheck(managementClient); } catch (UnexpectedHttpStatusCodeException exception) { return new CheckResult(true, string.Format("Check '{0}' got unexpected status code {1} {2}", check.GetType().ToString(), exception.StatusCodeNumber, exception.StatusCode )); } catch (Exception exception) { return new CheckResult(true, exception.ToString()); } }
public IssueTemplateDoesNotExist(ICheck check) : base(check, IssueType.Problem, "The {0} file \"{1}\" does not exist.") { }
public static ICheckLink <ICheck <sbyte> > IsNegative(this ICheck <sbyte> check) { var numberCheckStrategy = new NumberCheck <sbyte>(check); return(numberCheckStrategy.IsStrictlyNegative()); }
/// <summary> /// Select the best (up to) <num> targets (in <targetType> order) satisfying <predicate> from the threat list and stores them in <targetList> (which is cleared first). /// If <offset> is nonzero, the first <offset> entries in <targetType> order (or MAXTHREAT order, if <targetType> is RANDOM) are skipped. /// </summary> public List <Unit> SelectTargetList(uint num, SelectAggroTarget targetType, uint offset, ICheck <Unit> selector) { var targetList = new List <Unit>(); ThreatManager mgr = GetThreatManager(); // shortcut: we're gonna ignore the first <offset> elements, and there's at most <offset> elements, so we ignore them all - nothing to do here if (mgr.GetThreatListSize() <= offset) { return(targetList); } if (targetType == SelectAggroTarget.MaxDistance || targetType == SelectAggroTarget.MinDistance) { foreach (HostileReference refe in mgr.GetThreatList()) { if (!refe.IsOnline()) { continue; } targetList.Add(refe.GetTarget()); } } else { Unit currentVictim = mgr.GetCurrentVictim(); if (currentVictim != null) { targetList.Add(currentVictim); } foreach (HostileReference refe in mgr.GetThreatList()) { if (!refe.IsOnline()) { continue; } Unit thisTarget = refe.GetTarget(); if (thisTarget != currentVictim) { targetList.Add(thisTarget); } } } // shortcut: the list isn't gonna get any larger if (targetList.Count <= offset) { targetList.Clear(); return(targetList); } // right now, list is unsorted for DISTANCE types - re-sort by MAXDISTANCE if (targetType == SelectAggroTarget.MaxDistance || targetType == SelectAggroTarget.MinDistance) { SortByDistance(targetList, targetType == SelectAggroTarget.MinDistance); } // now the list is MAX sorted, reverse for MIN types if (targetType == SelectAggroTarget.MinThreat) { targetList.Reverse(); } // ignore the first <offset> elements while (offset != 0) { targetList.RemoveAt(0); --offset; } // then finally filter by predicate targetList.RemoveAll(unit => !selector.Invoke(unit)); if (targetList.Count <= num) { return(targetList); } if (targetType == SelectAggroTarget.Random) { targetList = targetList.SelectRandom(num).ToList(); } else { targetList.Resize(num); } return(targetList); }
/// <summary> /// Checks that the actual value is positive or equal to zero. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException">The value is not positive or equal to zero.</exception> public static ICheckLink <ICheck <decimal> > IsPositiveOrZero(this ICheck <decimal> check) { return(new NumberCheck <decimal>(check).IsPositiveOrZero()); }
/// <summary> /// Checks that the actual value is strictly negative. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException">The value is not strictly negative.</exception> public static ICheckLink <ICheck <float> > IsStrictlyNegative(this ICheck <float> check) { return(new NumberCheck <float>(check).IsStrictlyNegative()); }
/// <summary> /// Checks that the actual value is NOT equal to zero. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <returns> /// <returns>A check link.</returns> /// </returns> /// <exception cref="FluentCheckException">The value is equal to zero.</exception> public static ICheckLink <ICheck <uint> > IsNotZero(this ICheck <uint> check) { return(check.Not.IsZero()); }
protected override void DoSetUp() { maxChannelsCheck = new MaxChannelsCheck(100); }
public IssueTemplateTooHighBitrate(ICheck check) : base(check, IssueType.Problem, "The audio bitrate ({0} kbps) exceeds {1} kbps.") { }
protected override void DoSetUp() { easyNetQErrorQueueCheck = new EasyNetQErrorQueueCheck(); }
/// <summary> /// Checks that the checker value is equal to another expected value. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <param name="expected">The expected value.</param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException">The checker value is not equal to the expected value.</exception> public static ICheckLink <ICheck <string> > IsEqualTo(this ICheck <string> check, object expected) { return(IsEqualTo(check, (string)expected)); }
/// <summary> /// Checks that the checker value is not equal to another expected value. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <param name="expected">The expected value.</param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException">The checker value is equal to the expected value.</exception> public static ICheckLink <ICheck <string> > IsNotEqualTo(this ICheck <string> check, string expected) { return(check.Not.IsEqualTo(expected)); }
/// <summary> /// Checks that the string has content. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException">The string is empty or null.</exception> public static ICheckLink <ICheck <string> > HasContent(this ICheck <string> check) { return(IsNotEmpty(check)); }
/// <summary> /// Checks that the string does not contain any of the given expected values. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <param name="values">The values not to be present.</param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException">The string contains at least one of the given strings.</exception> public static ICheckLink <ICheck <string> > DoesNotContain(this ICheck <string> check, params string[] values) { return(check.Not.Contains(values)); }
/// <summary> /// Initializes a new instance of the <see cref="NumberCheck{TN}" /> class. /// </summary> /// <param name="check">The fluent check.</param> public NumberCheck(ICheck <TN> check) { this.check = check; // ReSharper disable once SuspiciousTypeConversion.Global new Checker <TN, ICheck <TN> >((ICheckForExtensibility <TN, ICheck <TN> >)check); }
public IssueTemplateTooLowBitrate(ICheck check) : base(check, IssueType.Problem, "The audio bitrate ({0} kbps) is lower than {1} kbps.") { }
public IssueTemplateNoBitrate(ICheck check) : base(check, IssueType.Error, "The audio bitrate could not be retrieved.") { }
/// <summary> /// Checks that the actual value is equal to zero. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException">The value is not equal to zero.</exception> public static ICheckLink <ICheck <uint> > IsZero(this ICheck <uint> check) { return(new NumberCheck <uint>(check).IsZero()); }
/// <summary> /// Checks that the actual nullable value has no value and thus, is null. /// Note: this method does not return A check link since the nullable is null. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <exception cref="FluentCheckException">The value is not null.</exception> public static void HasNoValue(this ICheck <decimal?> check) { check.Not.HasAValue(); }
/// <summary> /// Checks that the actual value is positive or equal to zero. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException">The value is not positive or equal to zero.</exception> public static ICheckLink <ICheck <float> > IsPositiveOrZero(this ICheck <float> check) { return(new NumberCheck <float>(check).IsPositiveOrZero()); }
/// <summary> /// Checks that the actual value is NOT equal to zero. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <returns> /// <returns>A check link.</returns> /// </returns> /// <exception cref="FluentCheckException">The value is equal to zero.</exception> public static ICheckLink <ICheck <decimal> > IsNotZero(this ICheck <decimal> check) { return(check.Not.IsZero()); }
public static void IsNotEmpty <T>(this ICheck <IEnumerable <T> > check) { check.Not.IsEmpty(); }
public static ICheckLink <ICheck <decimal> > IsGreaterThan(this ICheck <decimal> check, decimal comparand) { return(check.Not.IsStrictlyLessThan(comparand)); }
/// <summary> /// Checks that the actual value is strictly negative. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException">The value is not strictly negative.</exception> public static ICheckLink <ICheck <decimal> > IsStrictlyNegative(this ICheck <decimal> check) { return(new NumberCheck <decimal>(check).IsStrictlyNegative()); }
/// <summary> /// Checks that the checked value is strictly greater than the comparand. /// </summary> /// <param name="check"> /// The fluent check to be extended. /// </param> /// <param name="comparand"> /// Comparand to compare the value to. /// </param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException"> /// The checked value is not strictly greater than the comparand. /// </exception> public static ICheckLink <ICheck <decimal> > IsStrictlyGreaterThan(this ICheck <decimal> check, decimal comparand) { return(new NumberCheck <decimal>(check).IsStrictlyGreaterThan(comparand)); }
/// <summary> /// Checks that the actual value is positive or equal to zero. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException">The value is not positive or equal to zero.</exception> public static ICheckLink <ICheck <sbyte> > IsPositiveOrZero(this ICheck <sbyte> check) { var numberCheckStrategy = new NumberCheck <sbyte>(check); return(numberCheckStrategy.IsPositiveOrZero()); }
/// <summary> /// Checks that the actual value is equal to another expected value. /// </summary> /// <param name="check"> /// The fluent check to be extended. /// </param> /// <param name="expected"> /// The expected value. /// </param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException"> /// The actual value is not equal to the expected value. /// </exception> public static ICheckLink <ICheck <decimal> > IsEqualTo(this ICheck <decimal> check, decimal expected) { return(EqualityHelper.PerformEqualCheck(check, expected)); }
public IssueTemplateNoneSet(ICheck check) : base(check, IssueType.Problem, "No {0} has been set.") { }
public static ICheckLink <ICheck <uint> > IsGreaterThan(this ICheck <uint> check, uint comparand) { return(check.Not.IsStrictlyLessThan(comparand)); }
/// <summary> /// Checks that the enumerable has the proper number of elements. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <param name="expectedCount">The expected count to be found.</param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException">The enumerable has not the expected number of elements.</exception> public static ICheckLink <ICheck <IEnumerable> > CountIs(this ICheck <IEnumerable> check, long expectedCount) { return(HasSize(check, expectedCount)); }
/// <summary> /// Checks that the checked value is strictly greater than the comparand. /// </summary> /// <param name="check"> /// The fluent check to be extended. /// </param> /// <param name="comparand"> /// Comparand to compare the value to. /// </param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException"> /// The checked value is not strictly greater than the comparand. /// </exception> public static ICheckLink <ICheck <uint> > IsStrictlyGreaterThan(this ICheck <uint> check, uint comparand) { return(new NumberCheck <uint>(check).IsStrictlyGreaterThan(comparand)); }
protected override void DoSetUp() { var log = MockRepository.GenerateStub<ILog>(); maxConnectionsCheck = new MaxConnectionsCheck(100, log); }
/// <summary> /// Checks that the actual value is equal to another expected value. /// </summary> /// <param name="check"> /// The fluent check to be extended. /// </param> /// <param name="expected"> /// The expected value. /// </param> /// <returns> /// A check link. /// </returns> /// <exception cref="FluentCheckException"> /// The actual value is not equal to the expected value. /// </exception> public static ICheckLink <ICheck <uint> > IsEqualTo(this ICheck <uint> check, uint expected) { return(EqualityHelper.PerformEqualCheck(check, expected)); }
protected override void DoSetUp() { maxQueuedMessagesCheck = new MaxQueuedMessagesCheck(100); }