public IEnumerable <MongoModel> ChooseLottery(List <List <string> > htmlLines, string lotteryName) { _logger.LogDebug($"Initializing loading for lottery {lotteryName}"); switch (lotteryName) { case "DuplaSena": return(DuplaSenaExtensionMethods.Load(htmlLines)); case "Federal": return(FederalExtensionMethods.Load(htmlLines)); case "TimeMania": return(TimeManiaExtensionMethods.Load(htmlLines)); case "Quina": return(QuinaExtensionMethods.Load(htmlLines)); case "LotoMania": return(LotoManiaExtensionMethods.Load(htmlLines)); case "LotoGol": return(LotoGolExtensionMethods.Load(htmlLines)); case "LotoFacil": return(LotoFacilExtensionMethods.Load(htmlLines)); case "Loteca": return(LotecaExtensionMethods.Load(htmlLines)); case "MegaSena": return(MegaSenaExtensionMethods.Load(htmlLines)); default: _logger.LogError($"Error when try to load lottery {lotteryName}."); throw new NotSupportedException($"Lottery {lotteryName} did not support."); } }
public void ExtensioMethod_LotoGol_Test() { var listOfValuesLotoGol = new List <List <string> > { new List <string> { "1", "18/02/2002", " ", " ", "0", "0,00", "SIM", "425.061,45", "3", "3.278,78", "NÃO", "0,00", "481", "20,38", "NÃO", "0,00", "2", "+", "3", "0", "2", "1", "1", "+", "+", "0", "0,00", "0,00" } }; var expectedLotoGol = new List <LotoGol> { new LotoGol { LotteryId = 1, DateRealized = new DateTime(2002, 02, 18), City = "", UF = "", Winners5 = 0, Average5 = 0.00m, IsAcumlated5 = true, Acumulated5 = 425061.45m, Winners4 = 3, Average4 = 3278.78m, IsAcumlated4 = false, Acumulated4 = 0.00m, Winners3 = 481, Average3 = 20.38m, IsAcumlated3 = false, Acumulated3 = 0.00m, Dozens = new List <string> { "2", "+", "3", "0", "2", "1", "1", "+", "+", "0" }.OrderBy(c => c).ToList(), TotalAmount = 0.00m, EstimatedPrize = 0.00m } }; var actualResult = LotoGolExtensionMethods.Load(listOfValuesLotoGol).ToList(); Assert.AreEqual(expectedLotoGol.ToString(), actualResult.ToString()); CollectionAssert.AreEqual(expectedLotoGol, actualResult); Assert.AreNotEqual(expectedLotoGol.First().GetHashCode(), actualResult.First().GetHashCode()); }