示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }