コード例 #1
0
        public void blob_file_exists_in_container()
        {
            using (var fs = File.Open(_filename, FileMode.Open))
            {
                byte[] bytes = new byte[fs.Length];
                fs.Read(bytes, 0, bytes.Length);
                var azureFileName = "";

                var service = new BlobFuService(_connectionString)
                              .SaveToBlobStorage(
                    new BlobStorageRequest
                {
                    BlobSavedCallback = (x) =>
                    {
                        azureFileName = x.AbsoluteUri;
                        Console.WriteLine(x.AbsoluteUri);
                    },
                    Container   = _container,
                    Filename    = _filename,
                    DataToStore = bytes
                });

                Assert.True(service.BlobExists(azureFileName));

                service.DeleteBlob(_filename);
            }
        }
コード例 #2
0
ファイル: UnitTests.cs プロジェクト: jalchr/BlobFu
        public void blob_can_be_deleted()
        {
            using (var fs = File.Open(_filename, FileMode.Open))
            {
                byte[] bytes = new byte[fs.Length];
                fs.Read(bytes, 0, bytes.Length);

                var service = new BlobFuService(_connectionString)
                    .SaveToBlobStorage(
                        new BlobStorageRequest
                        {
                            BlobSavedCallback = (x) =>
                            {
                                Console.WriteLine(x.AbsoluteUri);
                            },
                            Container = _container,
                            Filename = _filename,
                            DataToStore = bytes
                        })
                    .ListBlobs(new BlobListRequest
                    {
                        Container = _container,
                        ListReceivedCallback = (x) => Assert.That(x.Any())
                    });

                service.DeleteBlob(_filename);

                service.ListBlobs(new BlobListRequest
                {
                    Container = _container,
                    ListReceivedCallback = (x) =>
                        {
                            Assert.That(!x.Any(y => y == _filename));
                        }
                });
            }
        }
コード例 #3
0
        public void blob_can_be_deleted()
        {
            using (var fs = File.Open(_filename, FileMode.Open))
            {
                byte[] bytes = new byte[fs.Length];
                fs.Read(bytes, 0, bytes.Length);

                var service = new BlobFuService(_connectionString)
                              .SaveToBlobStorage(
                    new BlobStorageRequest
                {
                    BlobSavedCallback = (x) =>
                    {
                        Console.WriteLine(x.AbsoluteUri);
                    },
                    Container   = _container,
                    Filename    = _filename,
                    DataToStore = bytes
                })
                              .ListBlobs(new BlobListRequest
                {
                    Container            = _container,
                    ListReceivedCallback = (x) => Assert.That(x.Any())
                });

                service.DeleteBlob(_filename);

                service.ListBlobs(new BlobListRequest
                {
                    Container            = _container,
                    ListReceivedCallback = (x) =>
                    {
                        Assert.That(!x.Any(y => y == _filename));
                    }
                });
            }
        }
コード例 #4
0
ファイル: UnitTests.cs プロジェクト: jalchr/BlobFu
        public void blob_file_exists_in_container()
        {
            using (var fs = File.Open(_filename, FileMode.Open))
            {
                byte[] bytes = new byte[fs.Length];
                fs.Read(bytes, 0, bytes.Length);
                var azureFileName = "";

                var service = new BlobFuService(_connectionString)
                    .SaveToBlobStorage(
                        new BlobStorageRequest
                        {
                            BlobSavedCallback = (x) =>
                            {
                                azureFileName = x.AbsoluteUri;
                                Console.WriteLine(x.AbsoluteUri);
                            },
                            Container = _container,
                            Filename = _filename,
                            DataToStore = bytes
                        });

                Assert.True(service.BlobExists(azureFileName));

                service.DeleteBlob(_filename);
            }
        }