public void CanStopObjectIteration() { int count = 0; using (Repository repo = SandboxRepository("testrepo")) using (ObjectDatabase odb = repo.ObjectDatabase) { odb.ForEachObject((id) => { return((++count == 5) ? false : true); }); } Assert.Equal(5, count); }
public void CanIterateObjects() { int count = 0; using (Repository repo = SandboxRepository("testrepo")) using (ObjectDatabase odb = repo.ObjectDatabase) { odb.ForEachObject((id) => { count++; return(true); }); } Assert.Equal(1703, count); }
public void CanThrowDuringObjectIteration() { int count = 0; using (Repository repo = SandboxRepository("testrepo")) using (ObjectDatabase odb = repo.ObjectDatabase) { Assert.Throws <InvalidTimeZoneException>(() => { odb.ForEachObject((id) => { if (++count == 5) { throw new InvalidTimeZoneException(); } return(true); }); }); } Assert.Equal(5, count); }