Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expected = UnderlyingStorageException.class) public void incrementVersionMustThrowOnPageOverflow()
        public virtual void IncrementVersionMustThrowOnPageOverflow()
        {
            using (MetaDataStore store = NewMetaDataStore())
            {
                _fakePageCursorOverflow = true;
                store.IncrementAndGetVersion();
            }
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void incrementAndGetVersionMustBeAtomic() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void IncrementAndGetVersionMustBeAtomic()
        {
            using (MetaDataStore store = NewMetaDataStore())
            {
                long initialVersion = store.IncrementAndGetVersion();
                int  threads        = Runtime.Runtime.availableProcessors();
                int  iterations     = 500;
                Race race           = new Race();
                race.AddContestants(threads, () =>
                {
                    for (int i = 0; i < iterations; i++)
                    {
                        store.IncrementAndGetVersion();
                    }
                });
                race.Go();
                assertThat(store.IncrementAndGetVersion(), @is(initialVersion + (threads * iterations) + 1));
            }
        }