コード例 #1
0
        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.");
            }
        }
コード例 #2
0
        public void ExtensioMethod_TimeMania_Test()
        {
            var listOfValuesTimeMania = new List <List <string> >
            {
                new List <string>
                {
                    "1",
                    "01/03/2008",
                    "71",
                    "51",
                    "63",
                    "57",
                    "24",
                    "80",
                    "31",
                    "PALMAS/TO",
                    "0,00",
                    "0",
                    "&nbsp",
                    "&nbsp",
                    "6",
                    "328",
                    "6032",
                    "60403",
                    "13122",
                    "0,00",
                    "59.909,90",
                    "730,61",
                    "6,00",
                    "2,00",
                    "2,00",
                    "479.279,20",
                    "1.000.000,00"
                }
            };
            var expectedTimeMania = new List <TimeMania>
            {
                new TimeMania
                {
                    LotteryId    = 1,
                    DateRealized = new DateTime(2008, 03, 01),
                    Dozens       = new List <int> {
                        71, 51, 63, 57, 24, 80, 31
                    }.OrderBy(c => c).ToList(),
                    Team               = "PALMAS/TO",
                    TotalValue         = 0.00m,
                    TotalWinners7      = 0,
                    City               = string.Empty,
                    UF                 = string.Empty,
                    TotalWinners6      = 6,
                    TotalWinners5      = 328,
                    TotalWinners4      = 6032,
                    TotalWinners3      = 60403,
                    WinnersTeam        = 13122,
                    TotalValueNumbers7 = 0.00m,
                    TotalValueNumbers6 = 59909.90m,
                    TotalValueNumbers5 = 730.61m,
                    TotalValueNumbers4 = 6.00m,
                    TotalValueNumbers3 = 2.00m,
                    TeamValue          = 2.00m,
                    AccumulatedValue   = 479279.20m,
                    EstimatedPrize     = 1000000.00m
                }
            };

            var actualResult = TimeManiaExtensionMethods.Load(listOfValuesTimeMania).ToList();

            Assert.AreEqual(expectedTimeMania.ToString(), actualResult.ToString());
            CollectionAssert.AreEqual(expectedTimeMania, actualResult);
            Assert.AreNotEqual(expectedTimeMania.First().GetHashCode(), actualResult.First().GetHashCode());
        }