Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public void should_add_stream_and_delete()
        {
            var id = Guid.NewGuid().ToString();

            var repository = new MongoPolicy();

            using (var stream = new FileStream(file, FileMode.Open))
            {
                string mimetype = MimeMapping.GetMimeMapping(file);
                var result = repository.AddStream(stream, mimetype, id);
                repository.Copy(localfile, result.fileName);
                repository.Delete(result.fileName);

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