Example #1
0
        public async Task GetAll_ShouldReturnRepositories_WhenThereAreSome()
        {
            // Setup
            var expectedRepositories = Enumerable.Range(1, 4).Select(Generator.GenerateRepository).ToList();

            mockGitHubClient.Setup(c => c.Get <List <Repository> >("user/repos")).Returns(Task.FromResult(expectedRepositories));

            // Execute
            var actualRepositories = await service.GetAll();

            // Assert
            AssertUtils.AreIdentical(expectedRepositories, actualRepositories);
        }
Example #2
0
        // GET: Home
        public ActionResult Index()
        {
            ChannelsContext             con      = new ChannelsContext();
            RepositoryService <Channel> channels = new RepositoryService <Channel>(con);

            return(View(channels.GetAll().ToList()));
        }
Example #3
0
        protected void CheckAndAddNews(List <Channel> news)
        {
            ChannelsContext                 con          = new ChannelsContext();
            RepositoryService <Channel>     channels     = new RepositoryService <Channel>(con);
            RepositoryService <ChannelItem> channelItems = new RepositoryService <ChannelItem>(con);

            foreach (var item in channelItems.GetAll())
            {
                item.State = false;
                channelItems.Edit(item);
            }

            channelItems.Save();

            foreach (var item in news)
            {
                bool found = false;

                foreach (var item2 in channels.GetAll())
                {
                    if (item2.Link == item.Link)
                    {
                        found = true;
                    }
                }

                if (!found)
                {
                    channels.Add(item);
                }
            }
        }
 public ViewResult Index()
 {
     var context = new DataContext();
     var rfxRepository = new RepositoryService<Rfx>(context);
     var result = rfxRepository.GetById(1);
     result.Name = "Books";
     rfxRepository.Update(result);
     return View(rfxRepository.GetAll());
 }