public async Task <Operation <List <Channel> > > GetAll()
        {
            Operation <List <Channel> > op = new Operation <List <Channel> >()
            {
                ErrorMessages = new List <string>(),
                IsValid       = true
            };

            var channels = await _channelsService.GetChannelsAsync();

            if (channels == null || !channels.Any())
            {
                op.ErrorMessages.Add("No channels found");
                return(op);
            }


            op.Payload = channels.ToList();

            return(op);
        }
        public async Task <Operation <List <Event> > > GetEventsAsync(string deviceId, string channelId, CancellationToken ct = default(CancellationToken))
        {
            Operation <List <Event> > op = new Operation <List <Event> >()
            {
                IsValid       = true,
                ErrorMessages = new List <string>()
            };

            DateTime dtNow = DateTime.Now;

            DateTime start = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day, 0, 0, 0);
            DateTime end   = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day, 23, 59, 59);

            var subscribedChannels = await _channelsService.GetSubscribedChannelIdsAsync(deviceId);

            var channels = await _channelsService.GetChannelsAsync();

            var channelName = channels.Where(x => x.Id == channelId).Select(x => x.Name).FirstOrDefault();

            bool isSubscribed = subscribedChannels.Any(x => x == channelId);

            var programs = await _programsService.GetAllProgramsAsync();

            var events = programs.Where(x => x.StartTime >= start && x.EndTime <= end).Select(x => CreateEvent(x, isSubscribed, channelName));


            if (!events.Any())
            {
                op.ErrorMessages.Add("No events found");
                return(op);
            }

            op.Payload = events.ToList();

            return(op);
        }
        public void GetChannels_ShouldRetrieveChannels()
        {
            var channels = _channelsService.GetChannelsAsync().Result;

            Assert.IsTrue(channels.Any());
        }