public virtual void  TestIsCurrent()
        {
            RAMDirectory ramDir1 = new RAMDirectory();

            AddDoc(ramDir1, "test foo", true);
            RAMDirectory ramDir2 = new RAMDirectory();

            AddDoc(ramDir2, "test blah", true);
            IndexReader[] readers = new IndexReader[] { IndexReader.Open(ramDir1), IndexReader.Open(ramDir2) };
            MultiReader   mr      = new MultiReader(readers);

            Assert.IsTrue(mr.IsCurrent());             // just opened, must be current
            AddDoc(ramDir1, "more text", false);
            Assert.IsFalse(mr.IsCurrent());            // has been modified, not current anymore
            AddDoc(ramDir2, "even more text", false);
            Assert.IsFalse(mr.IsCurrent());            // has been modified even more, not current anymore
            try
            {
                mr.GetVersion();
                Assert.Fail();
            }
            catch (System.NotSupportedException e)
            {
                // expected exception
            }
            mr.Close();
        }
Beispiel #2
0
        public virtual void  TestIsCurrent()
        {
            RAMDirectory ramDir1 = new RAMDirectory();

            AddDoc(ramDir1, "test foo", true);
            RAMDirectory ramDir2 = new RAMDirectory();

            AddDoc(ramDir2, "test blah", true);
            IndexReader[] readers = new IndexReader[] { IndexReader.Open(ramDir1, false), IndexReader.Open(ramDir2, false) };
            MultiReader   mr      = new MultiReader(readers);

            Assert.IsTrue(mr.IsCurrent());             // just opened, must be current
            AddDoc(ramDir1, "more text", false);
            Assert.IsFalse(mr.IsCurrent());            // has been modified, not current anymore
            AddDoc(ramDir2, "even more text", false);
            Assert.IsFalse(mr.IsCurrent());            // has been modified even more, not current anymore

            Assert.Throws <NotSupportedException>(() => { var ver = mr.Version; });
            mr.Close();
        }
		public virtual void  TestIsCurrent()
		{
			RAMDirectory ramDir1 = new RAMDirectory();
			AddDoc(ramDir1, "test foo", true);
			RAMDirectory ramDir2 = new RAMDirectory();
			AddDoc(ramDir2, "test blah", true);
			IndexReader[] readers = new IndexReader[]{IndexReader.Open(ramDir1), IndexReader.Open(ramDir2)};
			MultiReader mr = new MultiReader(readers);
			Assert.IsTrue(mr.IsCurrent()); // just opened, must be current
			AddDoc(ramDir1, "more text", false);
			Assert.IsFalse(mr.IsCurrent()); // has been modified, not current anymore
			AddDoc(ramDir2, "even more text", false);
			Assert.IsFalse(mr.IsCurrent()); // has been modified even more, not current anymore
			try
			{
				mr.GetVersion();
				Assert.Fail();
			}
			catch (System.NotSupportedException e)
			{
				// expected exception
			}
			mr.Close();
		}
        public virtual void  TestIsCurrent()
        {
            RAMDirectory ramDir1 = new RAMDirectory();
            AddDoc(ramDir1, "test foo", true);
            RAMDirectory ramDir2 = new RAMDirectory();
            AddDoc(ramDir2, "test blah", true);
            IndexReader[] readers = new IndexReader[]{IndexReader.Open(ramDir1, false), IndexReader.Open(ramDir2, false)};
            MultiReader mr = new MultiReader(readers);
            Assert.IsTrue(mr.IsCurrent()); // just opened, must be current
            AddDoc(ramDir1, "more text", false);
            Assert.IsFalse(mr.IsCurrent()); // has been modified, not current anymore
            AddDoc(ramDir2, "even more text", false);
            Assert.IsFalse(mr.IsCurrent()); // has been modified even more, not current anymore

            Assert.Throws<NotSupportedException>(() => { var ver = mr.Version; });
            mr.Close();
        }