Esempio n. 1
0
            public void NullContent_ExceptionThrown()
            {
                var path = Path.Combine(writeAllTextTestFolder, nameof(NullContent_ExceptionThrown));

                Directory.CreateDirectory(writeAllTextTestFolder);

                Assert.ThrowsAsync <ArgumentNullException>(async() => await AsyncFile.WriteAllTextAsync(path, null));
            }
Esempio n. 2
0
            public void WriteAllTextAsync_NullEncoding_ExceptionThrown()
            {
                const string content = "This is a test line.";
                var          path    = Path.Combine(writeAllTextTestFolder, nameof(NullContent_ExceptionThrown));

                Directory.CreateDirectory(writeAllTextTestFolder);

                Assert.ThrowsAsync <ArgumentNullException>(async() => await AsyncFile.WriteAllTextAsync(path, content, null));
            }
Esempio n. 3
0
            public async Task WriteAllTextWithEncoding(Encoding encoding)
            {
                var contents = string.Join(Environment.NewLine, Enumerable.Repeat("This is a test line.", 150));
                var path     = Path.Combine(writeAllTextTestFolder, nameof(WriteAllTextWithEncoding));

                Directory.CreateDirectory(writeAllTextTestFolder);

                await AsyncFile.WriteAllTextAsync(path, contents, encoding);

                var result = File.ReadAllText(path, encoding);

                Assert.AreEqual(contents, result);
            }