Ejemplo n.º 1
0
        public ActionResult Post()
        {
            NightService nightService = new NightService();

            return(nightService.Post());
            // var dbConnector = new DBConnector();
            // //get hours 9 hours from utc or 3 hours before central time to cover open till 3
            // var todaysDate = DateTime.Today.ToString("yyyy-MM-dd");

            // try
            // {
            //     if (dbConnector.IsNightActive(todaysDate) == false)
            //     {
            //         Console.WriteLine("night does not exist");
            //         dbConnector.CreateNewNight(todaysDate);
            //     }
            // }
            // catch (Exception ex)
            // {
            //     Console.WriteLine(ex.Message + ex.InnerException);
            //     return BadRequest();
            // }

            // return Ok();
        }
Ejemplo n.º 2
0
        public void Calculate_DoubleCoffe_ReturnCoffeCount()
        {
            var service = new NightService();
            var array   = new string[] { "1", "2", "3", "4", "2" };

            var output = service.CalculateOrder(array);

            Assert.Equal("steak, potato(x2), wine, cake", output);
        }
Ejemplo n.º 3
0
        public void Calculate_DuplicatedValues_ReturnDistinct()
        {
            var service = new NightService();
            var array   = new string[] { "1", "1", "2", "3" };

            var output = service.CalculateOrder(array);

            Assert.Equal("steak, potato, wine", output);
        }
Ejemplo n.º 4
0
        public IDayTimeService BuildAndGetInstance()
        {
            IDayTimeService nightService     = new NightService();
            IDayTimeService duskService      = new DuskService(nightService);
            IDayTimeService afternoonService = new AfternoonService(duskService);
            IDayTimeService noonService      = new NoonService(afternoonService);
            IDayTimeService morningService   = new MorningService(noonService);
            IDayTimeService dawnService      = new DawnService(morningService);

            return(dawnService);
        }
Ejemplo n.º 5
0
        public NightServiceTest()
        {
            _nightRepository = new Mock <INightRepository>();

            _nightRepository.Setup(x => x.GetAll()).ReturnsAsync(new List <Night>()
            {
                new Night(DishType.Entree, "Steak"),
                new Night(DishType.Side, "Potato"),
                new Night(DishType.Drink, "Wine"),
                new Night(DishType.Dessert, "Cake"),
                new Night(DishType.Dessert, "Error")
            });

            _nightService = new NightService(_nightRepository.Object);
        }