public void AddCommentToProduct() { Pcomment commment = new Pcomment() { part = prod.part, comment = "this is a red part", date = DateTime.Now }; prod.Pcomments.Add(commment); Assert.AreEqual(1, prod.Pcomments.Count); }
public void AddPcommentToProduct() { IUnitOfWork uow = facade.GetUnitOfWork(); Product p = uow.ProductRepo.GetById(2); Pcomment comment1 = new Pcomment() { part = p.part, comment = "this is a useless comment", date = DateTime.Now }; if (null != p && comment1.NoErrors) { p.Pcomments.Add(comment1); uow.Commit(); Assert.AreEqual(2, uow.NumberOfObjectsWritten); facade.ReturnUnitOfWork(); } else { facade.ReturnUnitOfWork(); Assert.False(comment1.HasErrors); } }
protected void Setup() { pcom = new Pcomment(); entityType = typeof(Pcomment); }