Exemple #1
0
            public void NullEncoding_ExceptionThrown()
            {
                var contents = string.Join(Environment.NewLine, Enumerable.Repeat("This is a test line.", 150));
                var path     = Path.Combine(readAllTextTestFolder, nameof(NullEncoding_ExceptionThrown));

                Directory.CreateDirectory(readAllTextTestFolder);
                File.WriteAllText(path, contents);

                Assert.ThrowsAsync <ArgumentNullException>(async() => await AsyncFile.ReadAllTextAsync(path, null).ConfigureAwait(false));
            }
Exemple #2
0
            public async Task ReadAllTextWithEncoding(Encoding encoding)
            {
                var contents = string.Join(Environment.NewLine, Enumerable.Repeat("This is a test line.", 150));
                var path     = Path.Combine(readAllTextTestFolder, nameof(ReadAllTextWithEncoding));

                Directory.CreateDirectory(readAllTextTestFolder);
                File.WriteAllText(path, contents, encoding);

                var result = await AsyncFile.ReadAllTextAsync(path, encoding).ConfigureAwait(false);

                Assert.AreEqual(contents, result);
            }