public async Task WriteCsvRecordsTestAsync() { FileHelper.CreateDirectory("temp"); string tempPath = "temp/" + DateTime.Now.ToString("yyyyMMddhhmmss.fff") + ".csv"; bool success = false; try { await CsvUtil.WriteRecordsAsync(Persons, tempPath); } catch { success = false; } finally { if (File.Exists(tempPath)) { success = true; File.Delete(tempPath); } } Assert.IsTrue(success); }