Esempio n. 1
0
        public void CalculateBeerPacks()
        {
            // real service

            IConfigurationBuilder configurationBuilder = new ConfigurationBuilder();

            configurationBuilder.AddJsonFile("appSettings.json");

            IConfiguration configuration = configurationBuilder.Build();

            IOptions <PaginationOptions> options = Options.Create(new PaginationOptions());

            var realMeetingService = new MeetingService(null, null, options);


            // calculara en base a 24.01 grados, o sea 2 por persona
            var weatherDto = new WeatherDto
            {
                Hourly = new HourlyDto
                {
                    data = new List <DatumDto>
                    {
                        new DatumDto
                        {
                            //solo necetiso la hora y la temp
                            time        = 1611183600, // representa el 20/01/201 20:00hs en EPOCH time
                            temperature = 24.01d      // deberia calcular 2 per cápita
                        }
                    }
                }
            };

            //meeting 2(mock) es para la plata, dentro de 1 dia
            var meeting2 = _meetingService.GetMeeting(2).Result;

            var totalDays = 1;// faltaria un dia para la meeting

            // cantidad de invitado qeu hicieron checkin, en este caso seran 10
            int attendes = _meetingService.GetAttendedCount(meeting2.MeetingId).Result;

            int result = realMeetingService.CalculateBeers(meeting2.Date, weatherDto, attendes, totalDays);

            Assert.AreEqual(4, result);
        }