public void Ensure_AddTicketToProject_Saves_Ticket() { Project project = new Project(); Ticket ticket = new Ticket(); _ticketService.AddTicketToProject(ticket, project); _mockTicketRepo.Verify(tr => tr.Save(ticket)); }
public void Ensure_AddTicketToProject_Increments_Project_TicketIndex() { Project project = new Project { TicketIndex = 1 }; Ticket ticket = new Ticket(); _ticketService.AddTicketToProject(ticket, project); Assert.AreEqual(2, project.TicketIndex); }
private static void AddListingToIndex(Ticket ticket, IndexWriter writer) { Document doc = new Document(); doc.Add(new Field("id", ticket.Id.ToString(), Field.Store.YES, Field.Index.UN_TOKENIZED)); doc.Add(new Field("summary", ticket.Summary, Field.Store.YES, Field.Index.TOKENIZED)); doc.Add(new Field("keyName", ticket.KeyName, Field.Store.YES, Field.Index.TOKENIZED)); writer.AddDocument(doc); }
public void Ensure_AddTicketToProject_Uses_UnitOfWork() { Project project = new Project(); Ticket ticket = new Ticket(); _ticketService.AddTicketToProject(ticket, project); //test both beging and commit //cannot test method ordering _mockUnitOfWork.Verify(uow => uow.Begin()); _mockUnitOfWork.Verify(uow => uow.Commit()); }
public void Ensure_AddTicketToProject_Sets_ProjectId_For_Ticket() { Project project = new Project { Id = 99 }; Ticket ticket = new Ticket(); _ticketService.AddTicketToProject(ticket, project); Assert.AreEqual(99, ticket.ProjectId); }