Example #1
0
        public void should_add_file_and_delete()
        {
            var id = Guid.NewGuid().ToString();

            var repository = new MongoPolicy();
            var result     = repository.Add(file, id);

            Assert.IsTrue(repository.Exist(id));

            repository.Delete(result.fileName);
            Assert.IsFalse(repository.Exist(id));
        }
Example #2
0
        public void should_copy_to_localfile()
        {
            var id = Guid.NewGuid().ToString();

            var repository = new MongoPolicy();

            var result = repository.Add(file, id);

            repository.Copy(localfile, result.fileName);
            repository.Delete(result.fileName);

            Assert.IsTrue(File.Exists(localfile));
            File.Delete(localfile);
        }
Example #3
0
        public void should_copy_to_localstream()
        {
            string id = Guid.NewGuid().ToString();

            var repository = new MongoPolicy();

            repository.Add(file, id);
            byte[] bytes = repository.GetBytes(id);
            repository.Delete(id);

            using (var fs = new FileStream(localfile, FileMode.Create))
            {
                fs.Read(bytes, 0, bytes.Count());
            }

            Assert.IsTrue(File.Exists(localfile));
            File.Delete(localfile);
        }