Exemplo n.º 1
0
        public void GetContainerTest()
        {
            BlobLogUploaderTest uploader  = new BlobLogUploaderTest();
            CloudBlobContainer  container = uploader.GetContainer(TestUtility.GetAzureCredential());

            Assert.AreEqual("container1", container.Name);
        }
Exemplo n.º 2
0
        public void GetDestinationBlobTest()
        {
            string rootSrcDirectory = "c:\\my";
            string srcPath          = "c:\\my\\1\\2\\3.txt";

            BlobLogUploaderTest uploader     = new BlobLogUploaderTest();
            CloudBlobContainer  dstContainer = uploader.GetContainer(TestUtility.GetAzureCredential());

            CloudBlockBlob dstBlob = BlobLogUploader.GetDestinationBlob(rootSrcDirectory, srcPath, dstContainer);

            Assert.AreEqual("1/2/3.txt", dstBlob.Name);
            Assert.AreEqual(dstContainer.Name, dstBlob.Container.Name);

            srcPath = "c:\\my\\3.txt";
            dstBlob = BlobLogUploader.GetDestinationBlob(rootSrcDirectory, srcPath, dstContainer);
            Assert.AreEqual("3.txt", dstBlob.Name);
            Assert.AreEqual(dstContainer.Name, dstBlob.Container.Name);
        }
Exemplo n.º 3
0
        public void UploadTest()
        {
            TestUtility.TestProlog();

            string traceLogPath = Utility.GenerateProgramFilePath(Program.Config.WorkingDirectoryPath, ".log");

            using (TraceLogger traceLogger = new TraceLogger(traceLogPath))
            {
                using (LogPackage logPackage = new LogPackage(Program.Config.OutputDirectoryPath, traceLogger))
                {
                    foreach (KeyValuePair <string, string> log in TestUtility.ExistingTestLogs)
                    {
                        Assert.IsTrue(logPackage.AddFile(string.Format("{0}/{1}", log.Key, log.Value), Path.Combine(TestUtility.TestDirectory, log.Value), true));
                    }

                    BlobLogUploaderTest uploader = new BlobLogUploaderTest(traceLogger);
                    uploader.UploadAsync(logPackage, TestUtility.GetAzureCredential()).Wait();
                    Assert.AreEqual(4, uploader.fileUploaded);
                }
            }

            File.Delete(traceLogPath);
            TestUtility.TestEpilog();
        }