Asynchronous executions
public class FileLoader
{
public string Load(string filePath) { ... }
public Task<string> LoadAsync(string filePath) { ... }
}
[Test]
public void Load_retrieves_file()
{
// ARRANGE
var fileName = "my_file.txt";
var sut = new FileLoader();
// ACT
var result = sut.Load(fileName);
// ASSERT
Assert.That(result, Is.Not.Null);
}
[Test]
public async Task LoadAsync_retrieves_file()
{
// ARRANGE
var fileName = "my_file.txt";
var sut = new FileLoader();
// ACT
var result = await sut.LoadAsync(fileName);
// ASSERT
Assert.That(result, Is.Not.Null);
}Last updated
Was this helpful?