using Assert = NUnit.Framework.Legacy.ClassicAssert;
private static readonly Random random = new Random();
return random.Next(1, 7);
public bool CheckDiceRolls(int roll1, int roll2, int roll3)
return roll1 == 6 && roll2 == 5 && roll3 == 4;
public void PrintRollingDicesStatus()
for (int i = 1; i <= 3; i++)
Console.WriteLine($"Attempt {i}: Rolled {roll1}, {roll2}, {roll3}");
if (CheckDiceRolls(roll1, roll2, roll3))
Console.WriteLine("Success! Got 6-5-4.");
Console.WriteLine("Failed to get 6-5-4 within three attempts.");
Console.WriteLine($"An error occurred: {ex.Message}");
public class DiceRollingTests
public void CheckDiceRolls_ReturnsTrue_WhenRollsMatch654()
DiceRolling diceRolling = new DiceRolling();
Assert.That(diceRolling.CheckDiceRolls(6, 5, 4), Is.True);
public void CheckDiceRolls_ReturnsFalse_WhenRollsDoNotMatch654()
DiceRolling diceRolling = new DiceRolling();
Assert.That(diceRolling.CheckDiceRolls(1, 2, 3), Is.False);
Assert.That(diceRolling.CheckDiceRolls(6, 5, 1), Is.False);
Assert.That(diceRolling.CheckDiceRolls(6, 1, 4), Is.False);
Assert.That(diceRolling.CheckDiceRolls(1, 5, 4), Is.False);
public void RollDice_ReturnsNumberBetween1And6()
DiceRolling diceRolling = new DiceRolling();
for (int i = 0; i < 100; i++)
int roll = diceRolling.RollDice();
Assert.That(roll, Is.GreaterThanOrEqualTo(1) & Is.LessThanOrEqualTo(6));
public void PrintRollingDicesStatus_NoException()
DiceRolling diceRolling = new DiceRolling();
Assert.DoesNotThrow(() => diceRolling.PrintRollingDicesStatus());
public static void Main()
new NUnitLite.AutoRun().Execute(["--noc" ]);