Beispiel #1
0
        public DownloadFile(Guid fileGuid, string userName)
        {
            DirectoryInfo objDirectoryInfo = new DirectoryInfo(FileStorage.Provider.ConnectionString);

            _File     = FileBroker.SelectByGuid(fileGuid, objDirectoryInfo);
            _UserName = userName;
        }
Beispiel #2
0
        public void InsertTest()
        {
            MF.File       f  = null;
            DirectoryInfo di = null;

            #region Null values
            try
            {
                Memba.Files.Business.FileBroker.Insert(f, di);
            }
            catch (Exception Ex)
            {
                Assert.IsInstanceOfType(Ex, typeof(ArgumentNullException));
            }
            #endregion

            f = new MF.File(
                FileBrokerTest.FileName,
                FileBrokerTest.ContentType,
                FileBrokerTest.Key,
                FileBrokerTest.Size,
                FileBrokerTest.HashValue);
            di = new DirectoryInfo(Constants.BadDirectory);

            #region Directory does not exist
            try
            {
                Memba.Files.Business.FileBroker.Insert(f, di);
            }
            catch (Exception Ex)
            {
                Assert.IsInstanceOfType(Ex, typeof(ArgumentException));
            }
            #endregion

            di = new DirectoryInfo(Constants.Directory);

            #region Correct values
            Memba.Files.Business.FileBroker.Insert(f, di);
            FileBrokerTest.Guid      = f.Guid;
            FileBrokerTest.CreatedOn = f.CreatedOn;
            string   sDefinitionFile = FileBrokerTest.Guid.ToString("N") + ".def";
            FileInfo objFileInfo     = new FileInfo(Path.Combine(Constants.Directory, sDefinitionFile));
            Assert.IsTrue(objFileInfo.Exists);
            #endregion
        }