using System.Collections.Generic;
using System.Threading.Tasks;
public static void Main()
new Casino("1-0", "1-2", "1-3", "1-4", "1-5", "1-6", "1-7", "1-8");
new Casino("1-0", "1-2", "1-3");
new Casino("1-0", "1-2", "1-3", "1-4", "1-5", "1-6", "1-7", "1-8");
Casino casino = new Casino("1-0", "1-2", "1-3", "1-4");
casino.OnJackpot += j => Console.WriteLine($"Jackpot! {j.Total}");
var m = new RiggedMachine { Id = "r-1-5", Gain = 0 };
if (casino.PlayOn(j, "r-1-5") != 1000)
throw new Exception("Casino total is not 1000");
foreach (var machine in casino.Machines)
Console.Write($"{machine.Id}: {machine.Gain} | ");
if (casino.Total != 1000)
throw new Exception("Casino total is not 1000");
Console.WriteLine($"\nFin de journée: {casino.Total}");
if ((String)casino != $"Mon Casino {String.Join(",", casino.MachinesRefs.Select(m => m.Key))}")
throw new Exception("Wrong casino name");
Console.WriteLine($"{(string)casino}");
var t = casino.Machines.Length;
if (casino.Machines.Length != t + 1)
throw new Exception("Casino does not have the right number of machines");
casino.MaintainsMachine(Maintain);
void Maintain(Memory<Machine> machines)
var l = casino.Machines.ToList();
if (l.Except(machines.ToArray()).Count() != 0)
throw new Exception("Maintain does not work");
if (l.Union(machines.ToArray()).Count() != 4)
throw new Exception("Maintain does not work");