public virtual void TestUpdatesAreFlushed()
{
Directory dir = NewDirectory();
IndexWriter writer = new IndexWriter(dir, (IndexWriterConfig)NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false)).SetRAMBufferSizeMB(0.00000001));
writer.AddDocument(Doc(0)); // val=1
writer.AddDocument(Doc(1)); // val=2
writer.AddDocument(Doc(3)); // val=2
writer.Commit();
Assert.AreEqual(1, writer.FlushDeletesCount);
writer.UpdateBinaryDocValue(new Term("id", "doc-0"), "val", ToBytes(5));
Assert.AreEqual(2, writer.FlushDeletesCount);
writer.UpdateBinaryDocValue(new Term("id", "doc-1"), "val", ToBytes(6));
Assert.AreEqual(3, writer.FlushDeletesCount);
writer.UpdateBinaryDocValue(new Term("id", "doc-2"), "val", ToBytes(7));
Assert.AreEqual(4, writer.FlushDeletesCount);
writer.Config.SetRAMBufferSizeMB(1000d);
writer.UpdateBinaryDocValue(new Term("id", "doc-2"), "val", ToBytes(7));
Assert.AreEqual(4, writer.FlushDeletesCount);
writer.Dispose();
dir.Dispose();
}