Exemple #1
0
        public void FileChooserModel_GetFilesExpectPassThrough()
        {
            //------------Setup for test--------------------------
            var qm   = new Mock <IQueryManager>();
            var file = new FileListing()
            {
                Name = @"c:\"
            };

            qm.Setup(a => a.FetchFiles(file)).Returns(new List <IFileListing>()
            {
                new FileListing()
                {
                    Name = @"c:\"
                }
            });
            var emailAttachmentModel = new FileChooserModel(qm.Object);

            //------------Execute Test---------------------------
            var drives = emailAttachmentModel.FetchFiles(file);

            //------------Assert Results-------------------------

            Assert.AreEqual(drives.Count, 1);
            Assert.AreEqual(drives[0].Name, @"c:\");
        }
Exemple #2
0
        public void FileChooserModel_GetDrivesAndFilterExpectPassThrough()
        {
            //------------Setup for test--------------------------
            var qm    = new Mock <IQueryManager>();
            var mock  = new Mock <IFileListing>();
            var mock1 = new Mock <IFile>();

            mock1.Setup(file => file.GetAttributes(It.IsAny <string>())).Returns(FileAttributes.Compressed | FileAttributes.System);
            qm.Setup(a => a.FetchFiles(mock.Object)).Returns(new List <IFileListing>()
            {
                new FileListing()
                {
                    FullName = @"c:home.js"
                }, new FileListing()
                {
                    Name = @"d:\", FullName = @"d:\"
                }
            });
            var emailAttachmentModel = new FileChooserModel(qm.Object, "js", mock1.Object);



            //------------Execute Test---------------------------

            var files = emailAttachmentModel.FetchFiles(mock.Object);

            //------------Assert Results-------------------------

            Assert.AreEqual(files.Count, 1);
            Assert.AreEqual(files[0].FullName, @"c:home.js");
        }