Rename is-in-any check method to a more legible name

This commit is contained in:
Salman Ahmed 2020-04-29 05:08:38 +03:00
parent 8d899f4e77
commit 6e76e5900a
No known key found for this signature in database
GPG Key ID: ED81FD33FD9B58BC
3 changed files with 13 additions and 13 deletions

View File

@ -29,9 +29,9 @@ public void TestCheckValueInsideSinglePeriod()
var tracker = new PeriodTracker { Periods = test_single_period };
var period = test_single_period.Single();
Assert.IsTrue(tracker.Contains(period.Start));
Assert.IsTrue(tracker.Contains(getMidTime(period)));
Assert.IsTrue(tracker.Contains(period.End));
Assert.IsTrue(tracker.IsInAny(period.Start));
Assert.IsTrue(tracker.IsInAny(getMidTime(period)));
Assert.IsTrue(tracker.IsInAny(period.End));
}
[Test]
@ -40,7 +40,7 @@ public void TestCheckValuesInsidePeriods()
var tracker = new PeriodTracker { Periods = test_periods };
foreach (var period in test_periods)
Assert.IsTrue(tracker.Contains(getMidTime(period)));
Assert.IsTrue(tracker.IsInAny(getMidTime(period)));
}
[Test]
@ -49,7 +49,7 @@ public void TestCheckValuesInRandomOrder()
var tracker = new PeriodTracker { Periods = test_periods };
foreach (var period in test_periods.OrderBy(_ => RNG.Next()))
Assert.IsTrue(tracker.Contains(getMidTime(period)));
Assert.IsTrue(tracker.IsInAny(getMidTime(period)));
}
[Test]
@ -64,12 +64,12 @@ public void TestCheckValuesOutOfPeriods()
}
};
Assert.IsFalse(tracker.Contains(0.9), "Time before first period is being considered inside");
Assert.IsFalse(tracker.IsInAny(0.9), "Time before first period is being considered inside");
Assert.IsFalse(tracker.Contains(2.1), "Time right after first period is being considered inside");
Assert.IsFalse(tracker.Contains(2.9), "Time right before second period is being considered inside");
Assert.IsFalse(tracker.IsInAny(2.1), "Time right after first period is being considered inside");
Assert.IsFalse(tracker.IsInAny(2.9), "Time right before second period is being considered inside");
Assert.IsFalse(tracker.Contains(4.1), "Time after last period is being considered inside");
Assert.IsFalse(tracker.IsInAny(4.1), "Time after last period is being considered inside");
}
[Test]
@ -78,10 +78,10 @@ public void TestNullRemovesExistingPeriods()
var tracker = new PeriodTracker { Periods = test_single_period };
var period = test_single_period.Single();
Assert.IsTrue(tracker.Contains(getMidTime(period)));
Assert.IsTrue(tracker.IsInAny(getMidTime(period)));
tracker.Periods = null;
Assert.IsFalse(tracker.Contains(getMidTime(period)));
Assert.IsFalse(tracker.IsInAny(getMidTime(period)));
}
[Test]

View File

@ -48,7 +48,7 @@ protected override void Update()
var time = Clock.CurrentTime;
isBreakTime.Value = tracker.Contains(time)
isBreakTime.Value = tracker.IsInAny(time)
|| time < gameplayStartTime
|| scoreProcessor?.HasCompleted == true;
}

View File

@ -43,7 +43,7 @@ public IEnumerable<Period> Periods
/// Whether the provided time is in any of the added periods.
/// </summary>
/// <param name="time">The time value to check for.</param>
public bool Contains(double time)
public bool IsInAny(double time)
{
if (periods.Count == 0)
return false;