Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCleanupAutoCloseable() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCleanupAutoCloseable()
        {
            // GIVEN
            CleanupRule   rule    = new CleanupRule();
            AutoCloseable toClose = rule.Add(mock(typeof(AutoCloseable)));

            // WHEN
            SimulateTestExecution(rule);

            // THEN
            verify(toClose).close();
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCleanupObjectWithAppropriateCloseMethod() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCleanupObjectWithAppropriateCloseMethod()
        {
            // GIVEN
            CleanupRule rule    = new CleanupRule();
            Dirt        toClose = rule.Add(mock(typeof(Dirt)));

            // WHEN
            SimulateTestExecution(rule);

            // THEN
            verify(toClose).shutdown();
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldTellUserIllegalArgumentIfSo()
        public virtual void ShouldTellUserIllegalArgumentIfSo()
        {
            // GIVEN
            CleanupRule rule = new CleanupRule();

            try
            {
                rule.Add(new object());
                fail("Should not accept this object");
            }
            catch (System.ArgumentException)
            {               // OK, good
            }
        }
Пример #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCleanupMultipleObjectsInReverseAddedOrder() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCleanupMultipleObjectsInReverseAddedOrder()
        {
            // GIVEN
            CleanupRule   rule      = new CleanupRule();
            AutoCloseable closeable = rule.Add(mock(typeof(AutoCloseable)));
            Dirt          dirt      = rule.Add(mock(typeof(Dirt)));

            // WHEN
            SimulateTestExecution(rule);

            // THEN
            InOrder inOrder = inOrder(dirt, closeable);

            inOrder.verify(dirt, times(1)).shutdown();
            inOrder.verify(closeable, times(1)).close();
        }
Пример #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void simulateTestExecution(org.neo4j.test.rule.CleanupRule rule) throws Throwable
        private void SimulateTestExecution(CleanupRule rule)
        {
            rule.apply(new StatementAnonymousInnerClass(this)
                       , null).evaluate();
        }