public void CanGetAssignmentDetails() { // Arrange var exercises = new List<Exercise> { new Exercise{Body = "This is the body1"}, new Exercise{Body = "This is the body2"} }; using (var db = GetConfiguredDB()) { IList<string> exercisesIds; string assignmentId; using (var session = db.OpenSession()) { session.StoreCollection(exercises); exercisesIds = exercises.Select(e => e.Id).ToList(); var assignment = new Assignment {ExerciseIds = exercisesIds}; session.Store(assignment); session.SaveChanges(); assignmentId = assignment.Id; } WaitForNonStaleResults(db); // Act var sut = new AssignmentQueryService(db); var result = sut.Get(assignmentId); // Assert Assert.Equal(exercisesIds, result.Exercises.Select(e => e.__document_id)); } }
public void CreateAssignment(IList<string> exerciseIds) { using (var session = _db.OpenSession()) { var assignment = new Assignment(); session.Store(assignment); // Patch all specified exercises with the new assignment id. //session.Advanced.DatabaseCommands.UpdateByIndex(); session.SaveChanges(); } }