BetterCms.Tests.Core.ServiceTests.StorageTests.FileSystemStorageServiceTest.Should_Upload_Object_Successfully C# (CSharp) Method

Should_Upload_Object_Successfully() private method

private Should_Upload_Object_Successfully ( ) : void
return void
        public void Should_Upload_Object_Successfully()
        {
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test", Guid.NewGuid().ToString().Replace("-", string.Empty) + ".tmp");
            const string content = "test content";

            try
            {
                using (MemoryStream memoryStream = new MemoryStream())
                {
                    using (TextWriter writer = new StreamWriter(memoryStream))
                    {
                        writer.Write(content);
                        writer.Flush();

                        FileSystemStorageService storageService = new FileSystemStorageService();
                        storageService.UploadObject(
                            new UploadRequest
                                {
                                    Uri = new Uri(path),
                                    InputStream = memoryStream,
                                    CreateDirectory = true
                                });

                        Assert.IsTrue(File.Exists(path));
                        Assert.AreEqual(content, File.ReadAllText(path));
                    }
                }
            }
            finally
            {
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
            }
        }
    }