Rollback() public method

Rollback changes to the taxonomy writer and closes the instance. Following this method the instance becomes unusable (calling any of its API methods will yield an AlreadyClosedException).
public Rollback ( ) : void
return void
コード例 #1
0
        public virtual void TestRollback()
        {
            // Verifies that if rollback is called, DTW is closed.
            Directory dir = NewDirectory();
            var       dtw = new DirectoryTaxonomyWriter(dir);

            dtw.AddCategory(new FacetLabel("a"));
            dtw.Rollback();
            try
            {
                dtw.AddCategory(new FacetLabel("a"));
                Fail("should not have succeeded to add a category following rollback.");
            }
            catch (AlreadyClosedException)
            {
                // expected
            }

            dir.Dispose();
        }
コード例 #2
0
        public virtual void TestRollback()
        {
            // Verifies that if rollback is called, DTW is closed.
            Directory dir = NewDirectory();
            var dtw = new DirectoryTaxonomyWriter(dir);
            dtw.AddCategory(new FacetLabel("a"));
            dtw.Rollback();
            try
            {
                dtw.AddCategory(new FacetLabel("a"));
                Fail("should not have succeeded to add a category following rollback.");
            }
            catch (AlreadyClosedException)
            {
                // expected
            }

            dir.Dispose();
        }