public void FileSystemQuery_GetServerFolderShare_MultipleSlashesNoShareName_ExpectFalse()
        {
            //------------Setup for test--------------------------
            //------------Execute Test---------------------------
            var query = new FileSystemQuery();
            var res   = query.GetServerFolderShare("\\\\bobthebuilder", out string sServerFolderShare);

            //------------Assert Results-------------------------
            Assert.IsFalse(res);
        }
        public void FileSystemQuery_GetServerFolderShare_InvalidStartsWith_ExpectFalse()
        {
            //------------Setup for test--------------------------
            //------------Execute Test---------------------------
            var query = new FileSystemQuery();
            var res   = query.GetServerFolderShare("bobthebuilder", out string sServerFolderShare);

            //------------Assert Results-------------------------
            Assert.IsFalse(res);
        }
        public void FileSystemQuery_GetServerFolderShare_NullPath_ExpectFalse()
        {
            //------------Setup for test--------------------------
            //------------Execute Test---------------------------
            var query = new FileSystemQuery();
            var res   = query.GetServerFolderShare(null, out string sServerFolderShare);

            //------------Assert Results-------------------------
            Assert.IsFalse(res);
        }
        public void FileSystemQuery_GetServerFolderShare_MultipleSlashesShareName_ExpectTrue()
        {
            //------------Setup for test--------------------------
            var dir = new Mock <IDirectory>();

            dir.Setup(a => a.Exists("\\\\bobthebuilder\\dave")).Returns(true);

            //------------Execute Test---------------------------
            var query = new FileSystemQuery(dir.Object, null, new ShareCollectionFactory());
            var res   = query.GetServerFolderShare("\\\\bobthebuilder\\dave", out string sServerFolderShare);

            //------------Assert Results-------------------------
            Assert.IsTrue(res);
        }
        public void FileSystemQuery_GetServerFolderShare_DefaultValue_ExpectTrue()
        {
            //------------Setup for test--------------------------
            var dir = new Mock <IDirectory>();

            dir.Setup(a => a.Exists("\\\\bobthebuilder\\dave")).Returns(false).Verifiable();

            //------------Execute Test---------------------------
            var query = new FileSystemQuery(dir.Object, null, new ShareCollectionFactory());
            var res   = query.GetServerFolderShare("\\\\bobthebuilder\\dave\\", out string sServerFolderShare);

            //------------Assert Results-------------------------
            Assert.IsTrue(res);
            Assert.AreEqual(@"\\BOBTHEBUILDER\DAVE\", sServerFolderShare);
        }
示例#6
0
        public void FileSystemQuery_GetServerFolderShare_MultipleSlashesShareNameDoesNotExist_ExpectFalse()
        {
            //------------Setup for test--------------------------
            var dir = new Mock <IDirectory>();

            dir.Setup(a => a.Exists("\\\\bobthebuilder\\dave")).Returns(false).Verifiable();

            //------------Execute Test---------------------------
            var    query = new FileSystemQuery(dir.Object, new DirectoryEntryFactory(), new ShareCollectionFactory());
            string sServerFolderShare;
            var    res = query.GetServerFolderShare("\\\\bobthebuilder\\dave", out sServerFolderShare);

            //------------Assert Results-------------------------
            Assert.IsFalse(res);
            dir.Verify(a => a.Exists("\\\\bobthebuilder\\dave"));
        }