Exemplo n.º 1
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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
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
            }
        }