public void NullContent_ExceptionThrown() { var path = Path.Combine(writeAllTextTestFolder, nameof(NullContent_ExceptionThrown)); Directory.CreateDirectory(writeAllTextTestFolder); Assert.ThrowsAsync <ArgumentNullException>(async() => await AsyncFile.WriteAllTextAsync(path, null)); }
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)); }
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); }