コード例 #1
0
        public void SetupAsRoot_ShouldLoadRootFolderContents()
        {
            var rootNotes = new List <Note>
            {
                new Note()
                {
                    ID = Guid.NewGuid(), FolderID = Guid.Empty
                },
                new Note()
                {
                    ID = Guid.NewGuid(), FolderID = Guid.Empty
                }
            };
            var rootFolders = new List <Folder>
            {
                new Folder()
                {
                    ID = Guid.NewGuid(), ParentID = Guid.Empty
                },
                new Folder()
                {
                    ID = Guid.NewGuid(), ParentID = Guid.Empty
                }
            };

            Services.MockNoteDatabase.GetFoldersReturnLookup[Guid.Empty] = rootFolders;
            Services.MockNoteDatabase.GetNotesReturnLookup[Guid.Empty]   = rootNotes;

            ViewModel.Setup(new FolderPageSetupParameters()
            {
                FolderId = Guid.Empty
            });

            Assert.NotNull(ViewModel.FolderContentItems);
            Assert.Equal(4, ViewModel.FolderContentItems.Count);
            foreach (var fci in ViewModel.FolderContentItems)
            {
                if (fci.Identifier == FolderContentItemIdentifier.File)
                {
                    Assert.Contains(fci.ContentNote, rootNotes);
                }
                else if (fci.Identifier == FolderContentItemIdentifier.Folder)
                {
                    Assert.Contains(fci.ContentFolder, rootFolders);
                }
            }
        }
コード例 #2
0
ファイル: CommandTests.cs プロジェクト: Deijin27/NoteSharp
 public CommandTests()
 {
     Services  = new MockAppServiceProvider();
     ViewModel = new FolderPageViewModel(Services);
     folderId  = Guid.NewGuid();
     Services.MockNoteDatabase.FolderTable[folderId] = new Folder();
     ViewModel.Setup(new FolderPageSetupParameters()
     {
         FolderId = folderId
     });
 }
コード例 #3
0
ファイル: ListViewTests.cs プロジェクト: Deijin27/NoteSharp
        public ListViewTests()
        {
            Services  = new MockAppServiceProvider();
            ViewModel = new FolderPageViewModel(Services);

            fid            = Guid.Parse("69348ae3-c0e5-4ea8-b3d8-c3ba404fdd83");
            nestedFolderId = Guid.Parse("763cdab7-43de-4d06-b5e6-aa0bf04fd0b3");
            nestedNoteId   = Guid.Parse("069119f7-06e6-4fa2-93ee-f0e22ad305ca");
            var rootNotes = new List <Note>
            {
                new Note()
                {
                    ID = Guid.NewGuid(), FolderID = fid
                },
                new Note()
                {
                    ID = nestedNoteId, FolderID = fid
                },
                new Note()
                {
                    ID = Guid.NewGuid(), FolderID = fid
                }
            };
            var rootFolders = new List <Folder>
            {
                new Folder()
                {
                    ID = nestedFolderId, ParentID = fid
                },
                new Folder()
                {
                    ID = Guid.NewGuid(), ParentID = fid
                }
            };

            Services.MockNoteDatabase.GetFoldersReturnLookup[fid] = rootFolders;
            Services.MockNoteDatabase.GetNotesReturnLookup[fid]   = rootNotes;
            Services.MockNoteDatabase.FolderTable[fid]            = new Folder()
            {
                Name = "yountyufnt"
            };

            ViewModel.Setup(new FolderPageSetupParameters()
            {
                FolderId = fid
            });
        }