예제 #1
0
        public void UpdateUpdatesFolder()
        {
            const long   FolderId    = 4;
            const string updatedName = "UpdatedName";
            var          repo        = new FolderRepository(_context);

            var Folder = repo.Find(FolderId);

            Folder.Name = updatedName;
            repo.Update(Folder);

            var updatedFolder = repo.Find(FolderId);

            Assert.Equal(Folder, updatedFolder);
        }
예제 #2
0
        public void FindById()
        {
            const string expectedName = "Name5";
            var          repo         = new FolderRepository(_context);
            var          res          = repo.Find(5);

            Assert.Equal(expectedName, res.Name);
        }
예제 #3
0
        public ActionResult Index(long?root = null)
        {
            User user   = CurrentUser;
            var  filter = new FolderFilter
            {
                User = user,
                Root = root.HasValue ? folderRepository.Load(root.Value) : null
            };
            var folders = folderRepository.Find(filter);

            return(View(new FolderViewModel {
                Folders = folders,
                Entity = filter.Root
            }));
        }
예제 #4
0
        public void AddCorrectlyAddedFolder()
        {
            var Folder = new Folder {
                ProjectID = 1,
                ParentID  = 1,
                Name      = "NewNestedTestFolder"
            };

            var repo = new FolderRepository(_context);

            repo.Add(Folder);
            var res = repo.Find(Folder.Id);

            Assert.Equal(Folder, res);
        }
예제 #5
0
        public ActionResult Index(long?parent, FetchOptions fetchOptions)
        {
            Folder parentFolder = null;

            if (parent.HasValue)
            {
                parentFolder = folderRepository.Load(parent.Value);
            }
            var model = new FolderModel
            {
                Items = folderRepository.Find(new FolderFilter {
                    Parent = parentFolder
                }, fetchOptions),
                CurrentFolder = parentFolder,
                Parent        = parentFolder != null ? parentFolder.Parent : null
            };

            model.IsRootFolder = parent == null && model.Parent == null;
            return(View("List", model));
        }