public async Task MockFile_AppendAllTextAsync_ShouldPersistNewTextWithCustomEncoding()
        {
            // Arrange
            string path       = XFS.Path(@"c:\something\demo.txt");
            var    fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { path, new MockFileData("Demo text content") }
            });

            var file = new MockFile(fileSystem);

            // Act
            await file.AppendAllTextAsync(path, "+ some text", Encoding.BigEndianUnicode);

            // Assert
            var expected = new byte[]
            {
                68, 101, 109, 111, 32, 116, 101, 120, 116, 32, 99, 111, 110, 116,
                101, 110, 116, 0, 43, 0, 32, 0, 115, 0, 111, 0, 109, 0, 101,
                0, 32, 0, 116, 0, 101, 0, 120, 0, 116
            };

            CollectionAssert.AreEqual(
                expected,
                file.ReadAllBytes(path));
        }
        public async Task MockFile_AppendAllTextAsync_ShouldPersistNewTextWithDifferentEncoding()
        {
            // Arrange
            const string Path       = @"c:\something\demo.txt";
            var          fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { Path, new MockFileData("AA", Encoding.UTF32) }
            });

            var file = new MockFile(fileSystem);

            // Act
            await file.AppendAllTextAsync(Path, "BB", Encoding.UTF8);

            // Assert
            CollectionAssert.AreEqual(
                new byte[] { 255, 254, 0, 0, 65, 0, 0, 0, 65, 0, 0, 0, 66, 66 },
                fileSystem.GetFile(Path).Contents);
        }
        public async Task MockFile_AppendAllTextAsync_ShouldPersistNewText()
        {
            // Arrange
            string path       = XFS.Path(@"c:\something\demo.txt");
            var    fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { path, new MockFileData("Demo text content") }
            });

            var file = new MockFile(fileSystem);

            // Act
            await file.AppendAllTextAsync(path, "+ some text");

            // Assert
            Assert.AreEqual(
                "Demo text content+ some text",
                file.ReadAllText(path));
        }