public void LogContextAddAndRemoveTagsTest() { string tagKey = "teste1"; string tagValue = DateTime.Now.Ticks.ToString(); using (LogContext logContext = new LogContext(true)) { Assert.False(logContext.GetDictionary().ContainsKey(tagKey)); logContext.SetValue(tagKey, tagValue); Assert.True(logContext.GetDictionary().ContainsKey(tagKey)); Assert.Equal(logContext.GetDictionary()[tagKey], tagValue); //removing unknow tag does not result in exception logContext.Remove(DateTime.Now.Ticks.ToString()); logContext.Remove(tagKey); Assert.False(logContext.GetDictionary().ContainsKey(tagKey)); } }
public async Task <int> Delete(TEntity entity) { var addedEntry = _ctx.Remove(entity); return(await _ctx.SaveChangesAsync()); }
public void Delete(int logId) { Log log = _context.Logs.Find(logId); _context.Remove(log); }