BetterCms.Tests.Core.ServiceTests.StorageTests.FileSystemStorageServiceTest.Should_Download_Object_Successfully C# (CSharp) 메소드

Should_Download_Object_Successfully() 개인적인 메소드

private Should_Download_Object_Successfully ( ) : void
리턴 void
        public void Should_Download_Object_Successfully()
        {
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid().ToString().Replace("-", string.Empty) + ".tmp");
            const string content = "test content";
            try
            {
                File.WriteAllText(path, content);
                var storageService = new FileSystemStorageService();
                var downloadUri = new Uri(path);
                var download = storageService.DownloadObject(downloadUri);
                Assert.AreEqual(download.Uri, downloadUri);
                using (TextReader reader = new StreamReader(download.ResponseStream))
                {
                    string contentFromStream = reader.ReadToEnd();
                    Assert.AreEqual(content, contentFromStream);
                }
            }
            finally
            {
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
            }
        }