public void Add2NewLogDetail() { MainLog load = _repository.GetMain(mainGuid); int count = load.Details.Count; DetailLog log = new DetailLog() { Message = "test", Scenario = 12, Time = new DateTime(2014, 12, 31), }; load.AddDetail(log); DetailLog log1 = new DetailLog() { Message = "test1", Scenario = 12, Time = new DateTime(2014, 12, 31), }; load.AddDetail(log1); _repository.Update(load); load = _repository.GetMain(mainGuid); Assert.AreEqual(mainGuid, load.Id); Assert.AreEqual(count + 2, load.Details.Count); }
public virtual void AddDetail(DetailLog Detail) { Detail.Main = this; Details.Add(Detail); }
public void TwoRepMainDetailLoad() { DateTime time = new DateTime(2014, 12, 31); MainLog log = _repository.GetMain(mainGuid); int count = log.Details.Count; DetailLog det = new DetailLog() { Time = time, Message = "eee" }; log.AddDetail(det); _repository.Update(log); MainLog loaded = new Repository().GetMain(log.Id); Assert.AreEqual(count + 1, loaded.Details.Count); }
public void DetailLogErrorLoad() { DateTime time = new DateTime(2014, 12, 31); DetailLog log = new DetailLog() { Message = "xxx", Time = time }; log.Error = new ErrorLog() { Message = "error", Time = time }; _repository.Add(log); Assert.AreNotEqual(0, log.Error.Id); Assert.AreNotEqual("", log.Id.ToString()); DetailLog loaded = _repository.GetDetail(log.Id); Assert.AreEqual(loaded.Error.Message, log.Error.Message); }
public void SessionSaveLogDetailsInMainLog() { using (ISession session = NHibernateHelper.OpenSession()) using (ITransaction transaction = session.BeginTransaction()) { DateTime time = new DateTime(2014, 12, 31); MainLog log = new MainLog() { Message = "test", Scenario = 12, JobStartTime = time, JobEndTime = time }; DetailLog dlog = new DetailLog() { Message = "test", Time = time, Scenario = 12, }; log.AddDetail(dlog); session.Save(log); Assert.AreNotEqual(0, dlog.Main.Id); transaction.Commit(); MainLog loaded = _repository.GetMain(log.Id); Assert.AreEqual(log.Id, loaded.Id); Assert.AreEqual(log.Id, loaded.Details.First().Main.Id); } }
public void AddNewMainLoglWithDetailsAlreadyLoaded() { DateTime time = new DateTime(2014, 12, 31); MainLog log = _repository.GetMain(mainGuid); int count = log.Details.Count; DetailLog dlog = new DetailLog() { Message = "test", Time = time, Scenario = 12 }; log.AddDetail(dlog); _repository.Update(log); MainLog loaded = _repository.GetMain(log.Id); Assert.AreEqual(count + 1, loaded.Details.Count); DetailLog dlog1 = new DetailLog() { Message = "test1", Time = time, Scenario = 12 }; loaded.AddDetail(dlog1); _repository.Update(loaded); loaded = _repository.GetMain(log.Id); Assert.AreEqual(count + 2, loaded.Details.Count); }
public void AddNewMainLoglWithDetails() { DateTime time = new DateTime(2014, 12, 31); MainLog log = new MainLog() { Message = "test", Scenario = 12, JobStartTime = time, JobEndTime = time }; DetailLog dlog = new DetailLog() { Message = "test", Time = time, Scenario = 12 }; log.AddDetail(dlog); _repository.Add(log); Assert.AreNotEqual(0, dlog.Main.Id); MainLog loaded = _repository.GetMain(log.Id); Assert.AreEqual(log.Id, loaded.Id); Assert.AreEqual(log.Id, loaded.Details.First().Main.Id); }
public void AddNewLogDetailWithErrorAndGetError() { DateTime time = new DateTime(2014, 12, 31); DetailLog log = new DetailLog() { Message = "test", Scenario = 12, Time = time, Error = new ErrorLog() { Message = "test", Time = time, StackTrace = "stack" } }; _repository.Add(log); Assert.AreNotEqual(0, log.Error.Id); Assert.AreNotEqual("", log.Id.ToString()); DetailLog loaded = _repository.GetDetail(log.Id); Assert.IsNotNull(loaded.Error); }
public void AddNewLogDetailAndGetDetail() { DateTime time = new DateTime(2014, 12, 31); DetailLog log = new DetailLog() { Message = "test", Scenario = 12, Time = time, }; _repository.Add(log); Assert.AreNotEqual("", log.Id.ToString()); DetailLog loaded = _repository.GetDetail(log.Id); Assert.AreEqual("test", loaded.Message); }
public void AddIndependentNewLogDetail() { MainLog mainLog = _repository.GetMain(mainGuid); int count = mainLog.Details.Count; DetailLog logDetail = new DetailLog() { Message = "test", Scenario = 12, Time = DateTime.Now, Main = new MainLog() { Id = mainGuid } }; _repository.Add(logDetail); MainLog load = _repository.GetMain(mainGuid); Assert.AreEqual(mainGuid, load.Id); Assert.AreEqual(count + 1, load.Details.Count); }