Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void initializeThrowsForNullConfig()
        public virtual void InitializeThrowsForNullConfig()
        {
            DeferringStatementLocksFactory factory = new DeferringStatementLocksFactory();

            try
            {
                factory.Initialize(mock(typeof(Locks)), null);
                fail("Exception expected");
            }
            catch (Exception e)
            {
                assertThat(e, instanceOf(typeof(System.NullReferenceException)));
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void newInstanceThrowsWhenNotInitialized()
        public virtual void NewInstanceThrowsWhenNotInitialized()
        {
            DeferringStatementLocksFactory factory = new DeferringStatementLocksFactory();

            try
            {
                factory.NewInstance();
                fail("Exception expected");
            }
            catch (Exception e)
            {
                assertThat(e, instanceOf(typeof(System.InvalidOperationException)));
            }
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void newInstanceCreatesDeferredLocksWhenConfigSet()
        public virtual void NewInstanceCreatesDeferredLocksWhenConfigSet()
        {
            Locks        locks  = mock(typeof(Locks));
            Locks_Client client = mock(typeof(Locks_Client));

            when(locks.NewClient()).thenReturn(client);

            Config config = Config.defaults(deferred_locks_enabled, Settings.TRUE);

            DeferringStatementLocksFactory factory = new DeferringStatementLocksFactory();

            factory.Initialize(locks, config);

            StatementLocks statementLocks = factory.NewInstance();

            assertThat(statementLocks, instanceOf(typeof(DeferringStatementLocks)));
            assertThat(statementLocks.Optimistic(), instanceOf(typeof(DeferringLockClient)));
            assertSame(client, statementLocks.Pessimistic());
        }