Exemplo n.º 1
0
        public void Load()
        {
            var recentFileList = new RecentFileList()
            {
                MaxFilesNumber = 3
            };

            recentFileList.AddFile("Doc3");
            recentFileList.AddFile("Doc2");
            recentFileList.AddFile("Doc1");

            AssertHelper.ExpectedException <ArgumentNullException>(() => recentFileList.Load(null !));

            // Load an empty recent file list
            recentFileList.Load(new RecentFile[] { });
            Assert.IsFalse(recentFileList.RecentFiles.Any());

            recentFileList.Load(new[]
            {
                new RecentFile("NewDoc1")
                {
                    IsPinned = true
                },
                new RecentFile("NewDoc2"),
                new RecentFile("NewDoc3"),
                new RecentFile("NewDoc4")
            });
            AssertHelper.SequenceEqual(new[] { "NewDoc1", "NewDoc2", "NewDoc3" }, recentFileList.RecentFiles.Select(f => f.Path));
            AssertHelper.SequenceEqual(new[] { true, false, false }, recentFileList.RecentFiles.Select(f => f.IsPinned));
        }
Exemplo n.º 2
0
        public void LoadTest_Empty()
        {
            var recentFileList = new RecentFileList();

            recentFileList.MaxFilesNumber = 3;
            recentFileList.AddFile("Doc3");
            recentFileList.AddFile("Doc2");
            recentFileList.AddFile("Doc1");

            recentFileList.Load(new RecentFile[] { });
            Assert.IsFalse(recentFileList.RecentFiles.Any());
        }
Exemplo n.º 3
0
        public void LoadTest()
        {
            var recentFileList = new RecentFileList();

            recentFileList.MaxFilesNumber = 3;
            recentFileList.AddFile("Doc3");
            recentFileList.AddFile("Doc2");
            recentFileList.AddFile("Doc1");

            recentFileList.Load(new RecentFile[]
            {
                new RecentFile("NewDoc1")
                {
                    IsPinned = true
                },
                new RecentFile("NewDoc2"),
                new RecentFile("NewDoc3"),
                new RecentFile("NewDoc4")
            });
            Assert.IsTrue(recentFileList.RecentFiles.Select(f => f.Path).SequenceEqual(new[] { "NewDoc1", "NewDoc2", "NewDoc3" }));
            Assert.IsTrue(recentFileList.RecentFiles.Select(f => f.IsPinned).SequenceEqual(new[] { true, false, false }));
        }
Exemplo n.º 4
0
        public void LoadTest_Precondition()
        {
            var recentFileList = new RecentFileList();

            recentFileList.Load(null);
        }