public void TestUpdateWorkshop() { var workshop = new Workshop(); workshop.Date = DateTime.Now; workshop.Title = "Sample workshop"; workshop.Description = "Sample"; var reservation = new Reservation(); reservation.UserName = "******"; workshop.Reservations.Add(reservation); var repository = new WorkshopRepository(); repository.InsertOrUpdate(workshop); repository.Save(); var foundWorkshop = repository.Find(workshop.Id); foundWorkshop.Reservations.Add(new Reservation() { UserName = "******"}); repository.InsertOrUpdate(foundWorkshop); repository.Save(); var results = repository.Find(foundWorkshop.Id); Assert.AreEqual(2,results.Reservations.Count); }
public void TestInsertWorkshopWithReservations() { var workshop = new Workshop(); workshop.Date = DateTime.Now; workshop.Title = "Sample workshop"; workshop.Description = "Sample"; var reservation = new Reservation(); reservation.UserName = "******"; workshop.Reservations.Add(reservation); var repository = new WorkshopRepository(); repository.InsertOrUpdate(workshop); repository.Save(); var results = repository.Find(workshop.Id); Assert.IsNotNull(results); Assert.AreEqual(1,results.Reservations.Count); }