public void NonThreeBinaryDigitsNotScoredForBonus() { TossupBonusPhaseState phaseState = CreatePhaseInBonusStage(); Assert.IsFalse(phaseState.TryScoreBonus("11"), "Scoring the bonus should've failed for 2 splits"); Assert.AreEqual(0, phaseState.BonusScores.Count, "No bonus should've been scored for 2 digits"); Assert.IsFalse(phaseState.TryScoreBonus("1011"), "Scoring the bonus should've failed for 4 splits"); Assert.AreEqual(0, phaseState.BonusScores.Count, "No bonus should've been scored for 4 digits"); }
public void TenAndTwentyNotScoredForBonus() { TossupBonusPhaseState phaseState = CreatePhaseInBonusStage(); Assert.IsFalse(phaseState.TryScoreBonus("10"), "Scoring the bonus should've failed for 2 splits"); Assert.AreEqual( 0, phaseState.BonusScores.Count, "No bonus should've been scored for 10, since we don't know the splits"); Assert.IsFalse(phaseState.TryScoreBonus("20"), "Scoring the bonus should've failed for 4 splits"); Assert.AreEqual( 0, phaseState.BonusScores.Count, "No bonus should've been scored for 20, since we don't know the splits"); }
public void ThirtyStringScoredForBonus() { TossupBonusPhaseState phaseState = CreatePhaseInBonusStage(); Assert.IsTrue(phaseState.TryScoreBonus("30"), "Scoring the bonus should succeed"); Assert.AreEqual( TossupBonusPhaseState.DefaultBonusLength, phaseState.BonusScores.Count, "We should have three parts scored"); Assert.IsTrue( phaseState.BonusScores.All(score => score == 10), $"Not all parts were scored a 0: {string.Join('/', phaseState.BonusScores)}"); }
public void ThreeBinaryDigitsScoredForBonus() { TossupBonusPhaseState phaseState = CreatePhaseInBonusStage(); Assert.IsTrue(phaseState.TryScoreBonus("011"), "Scoring the bonus should succeed"); Assert.AreEqual( TossupBonusPhaseState.DefaultBonusLength, phaseState.BonusScores.Count, "We should have three parts scored"); CollectionAssert.AreEqual( new int[] { 0, 10, 10 }, phaseState.BonusScores.ToArray(), $"Not all parts were scored correctly. Expected 0/10/10, got {string.Join('/', phaseState.BonusScores)}"); }
public void TestStagesForCorrectBuzz() { TossupBonusPhaseState phaseState = new TossupBonusPhaseState(); Assert.IsFalse(phaseState.HasBonus, "We should have a bonus on a correct buzz"); Assert.AreEqual(PhaseStage.Tossup, phaseState.CurrentStage, "We should be in the tossup phase"); phaseState.AddBuzz(DefaultBuzz); Assert.IsTrue(phaseState.TryScoreBuzz(10), "Scoring the buzz should succeed"); Assert.IsTrue(phaseState.HasBonus, "We should have a bonus on a correct buzz"); Assert.AreEqual(PhaseStage.Bonus, phaseState.CurrentStage, "We should be in the bonus phase"); Assert.IsTrue(phaseState.TryScoreBonus("0"), "Scoring the bonus should succeed"); Assert.AreEqual(PhaseStage.Complete, phaseState.CurrentStage, "We should be done with this phase"); }
public void UndoBonusAfterScoringIt() { TossupBonusPhaseState phaseState = CreatePhaseInBonusStage(); Assert.IsTrue(phaseState.TryScoreBonus("0"), "Scoring the bonus should've succeeded"); Assert.AreEqual( TossupBonusPhaseState.DefaultBonusLength, phaseState.BonusScores.Count, "We should have three parts scored"); phaseState.Undo(out ulong?userId); Assert.IsNull(userId, "userId should be null (scoring a bonus)"); Assert.AreEqual(0, phaseState.BonusScores.Count, "Bonus scores should be cleared, but not gone"); Assert.AreEqual(PhaseStage.Bonus, phaseState.CurrentStage, "Unexpected stage after first undo"); Assert.IsTrue( phaseState.AlreadyScoredTeamIds.Contains(DefaultBuzz.TeamId), "Default player not in the list of already scored teams after the second undo"); Assert.AreEqual(1, phaseState.Actions.Count, "Unexpected number of buzzes recorded after the second undo"); phaseState.Undo(out userId); Assert.AreEqual(DefaultBuzz.UserId, userId, "userId should not be null after undoing the bonus score"); Assert.IsNull(phaseState.BonusScores, "Bonus scores should be gone"); Assert.AreEqual(PhaseStage.Tossup, phaseState.CurrentStage, "Unexpected stage after second undo"); }