public void NhDaoUsesContextToDetermineConversation() { INhConversation conv = MockRepository.GenerateMock<INhConversation>(); INhConversationContext context = MockRepository.GenerateStub<INhConversationContext>(); context.Stub(c => c.CurrentConversation).Return(conv); INhDao<Software> nhDao = new NhDao<Software>(context); IDao<Software> dao = nhDao; Assert.That(nhDao.CurrentConversation, Is.SameAs(conv)); Assert.That(dao.CurrentConversation, Is.SameAs(conv)); }
public void CanSaveAndUpdateAssignedSoftware() { var sw = new AssignedSoftware { Key = "AR", Name = "ActiveRecord" }; INhDao<AssignedSoftware> aDao = new NhDao<AssignedSoftware>(context); aDao.Add(sw); conv.Commit(); conv.Restart(); sw.Name = "ActiveRecord vNext"; aDao.Replace(sw); conv.Commit(); int count = 0; conv.Execute(s => count = s.Query<AssignedSoftware>().Where(ar => ar.Name.Contains("vNext")).Count()); Assert.That(count, Is.EqualTo(1)); }
public void CanSaveAssignedSoftware() { var sw = new AssignedSoftware { Key = "AR", Name = "ActiveRecord" }; INhDao<AssignedSoftware> aDao = new NhDao<AssignedSoftware>(context); aDao.Add(sw); conv.Commit(); int count = 0; conv.Execute(s => count = s.Query<AssignedSoftware>().Where(ar => ar.Key == "AR").Count()); Assert.That(count, Is.EqualTo(1)); }