示例#1
0
        public async Task AppendTextWorksWithSpecificCulture()
        {
            // --- Arrange
            const string BODY = "1,25-1,25";
            var          wfs  = new WindowsFileStorage(ROOT);
            var          file = new AbstractFileDescriptor("Container", null, "TestFile.txt");

            using (var textFile = await wfs.CreateTextAsync(file, new CultureInfo("hu-hu")))
            {
                textFile.Writer.Write(1.25);
            }

            // --- Act
            using (var textFile = await wfs.AppendTextAsync(file, new CultureInfo("hu-hu")))
            {
                textFile.Writer.Write(-1.25);
            }

            // --- Assert
            using (var savedFile = await wfs.OpenTextAsync(file))
            {
                var text = savedFile.Reader.ReadToEnd();
                text.ShouldBe(BODY);
            }
        }
示例#2
0
        public async Task AppendTextWorksWithUtf32()
        {
            // --- Arrange
            const string BODY = "FirstSecond";
            var          wfs  = new WindowsFileStorage(ROOT);
            var          file = new AbstractFileDescriptor("Container", null, "TestFile.txt");

            using (var textFile = await wfs.CreateTextAsync(file, encoding: Encoding.UTF32))
            {
                textFile.Writer.Write("First");
            }

            // --- Act
            using (var textFile = await wfs.AppendTextAsync(file, encoding: Encoding.UTF32))
            {
                textFile.Writer.Write("Second");
            }

            // --- Assert
            using (var savedFile = await wfs.OpenTextAsync(file))
            {
                var text = savedFile.Reader.ReadToEnd();
                text.ShouldBe(BODY);
            }
        }