private void Log(string Message, LogSeverity severity) { try { var user = GetUserName(); Task.Factory.StartNew(async() => { try { var logEntry = new LogEntry { Message = Message, Id = loggerId, Severity = severity }; if (string.IsNullOrEmpty(user) == false) { logEntry.User = user; } await csvFile.WriteAsync(logEntry); } catch { } }); } catch { } }
public async Task TestAsync() { CsvOf <MyModelExemple> sut = createSut(); await sut.WriteAsync( new MyModelExemple { NullableBool = true } ); var result = await sut.ReadAsync(); Assert.AreEqual(1, result.Count()); Assert.AreEqual(true, result.First().NullableBool); sut.Clear(); }