public void SaveLogsystem() { Logsystem logsystem = new Logsystem(); logsystem.ID = new Guid(originalLogID); logsystem.Message = originalMessage; logsystem.Ident = "4"; logsystem.Priority = "4"; logsystem.Logtime = DateTime.Now; db.Logsystem.Add(logsystem); db.SaveChanges(); // Test 1 Assert.IsNotNull(logsystem.ID); //Test 2 var newFound = db.Logsystem.Find(logsystem.ID); Assert.IsNotNull(newFound); }
public void InsertTestLogSystem() { //先默认插入10条Logsystem记录 Logsystem logsystem = new Logsystem(); int Count = db.Logsystem.Count(); for (int i = 0; i < 10; i++) { logsystem = new Logsystem(); logsystem.ID = new Guid(originalLogIDs[i]); logsystem.Message = originalMessage; logsystem.Ident = "4"; logsystem.Priority = "4"; logsystem.Logtime = DateTime.Now; db.Logsystem.Add(logsystem); } for (int i = 0; i < 90; i++) { logsystem = new Logsystem(); logsystem.ID = Guid.NewGuid(); logsystem.Message = originalMessage; logsystem.Ident = "4"; logsystem.Priority = "4"; logsystem.Logtime = DateTime.Now; db.Logsystem.Add(logsystem); } db.SaveChanges(); Assert.IsTrue(Count == db.Logsystem.Count() - 100); }