public void SetupController()
        {
            resultsRows = Builder<AwsEc2Status>.CreateListOfSize(totalRows).Build();
            repository = Substitute.For<IRepository<AwsEc2Status>>();
            repository.All().Returns(resultsRows.AsQueryable());

            RepositorySession.DefaultContainerType = typeof(FakeObjectContext);

            controller = new QuartzController(repository);
        }
        public void SetupController()
        {
            resultsRows = Builder<NiceLittleForm>.CreateListOfSize(TotalRows).Build();

            repository = Substitute.For<IRepository<NiceLittleForm>>();
            session = Substitute.For<IRepositorySession>();
            repository.All().Returns(resultsRows.AsQueryable());

            RepositorySession.DefaultContainerType = typeof(FakeObjectContext);

            controller = new NiceLittleFormController(repository, session);
        }
Example #3
0
        public CategoriesController(IRepository repository)
            : this()
        {
            _repository = repository;

            var catTree = _repository.All<CategoryTree>().FirstOrDefault();

            if (catTree != null)
              ViewBag.CategoryTree = catTree.Root;
        }
        private static void ClearDatabase(IRepository<News> repository)
        {
            foreach (var news in repository.All())
            {
                repository.Delete(news.Id);
            }

            repository.SaveChanges();
        }
Example #5
0
 protected bool CanDeleteUser(User user, IRepository repository)
 {
     var results = repository.All<MatchResult>().Any(r => r.Player.Id == user.Id);
       return !results;
 }