Example #1
0
        public async Task WriteFileBytesAppend()
        {
            var imageBytes = System.IO.File.ReadAllBytes(BinaryTestFilePath);

            TestFileContext.CreateBinaryFile("test.png", new byte[] { 137, 80, 78, 71, 13, 10, 26, 10 }); // empty png
            var result = await File.WriteBytes(
                new WriteBytesInput()
            {
                ContentBytes = imageBytes,
                Path         = Path.Combine(TestFileContext.RootPath, "test.png")
            },
                new WriteBytesOption()
            {
                WriteBehaviour = WriteBehaviour.Append
            });

            var fileContentBytes = System.IO.File.ReadAllBytes(result.Path);

            Assert.Equal(8 + imageBytes.Length, fileContentBytes.Length);
        }