Exemplo n.º 1
0
        public void Load_NoError()
        {
            var slots = new Slots();

            slots.Load();
            var allSlots = slots.GetAllLoaded();

            Assert.NotNull(allSlots);
        }
Exemplo n.º 2
0
        // GET: Slots
        public async Task <IActionResult> Index()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(Redirect("Identity/Account/Login"));
            }

            var list = new List <Slot>();

            slots.Load();

            DateTime now = DateTime.Now;

            list.AddRange(slots.GetAllLoaded().Where(s => s.TimeStart >= now));

            return(View(list.OrderBy(s => s.TimeStart)));
        }
Exemplo n.º 3
0
        public void Update_NoError()
        {
            var slots = new Slots();
            var slot  = new Slot()
            {
                PartitionKey = NOW.DayOfWeek.ToString(),
                RowKey       = "Slot 1",
                TimeStart    = NOW
            };

            slots.Update(slot);
            slots.Load();
            var allSlots    = slots.GetAllLoaded();
            var updatedSlot = allSlots.Where(s =>
            {
                return(s.PartitionKey == slot.PartitionKey &&
                       s.RowKey == slot.RowKey &&
                       s.Id == slot.Id &&
                       s.TimeStart == slot.TimeStart &&
                       s.IsBooked == true);
            });

            Assert.NotNull(updatedSlot);
        }