Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCloseTheSegments()
        public virtual void ShouldCloseTheSegments()
        {
            // Given
            Segments segments = new Segments(_fsa, _fileNames, _readerPool, _segmentFiles, _contentMarshal, _logProvider, -1);

            // When
            segments.Close();

            // Then
            foreach (SegmentFile file in _segmentFiles)
            {
                verify(file).close();
            }
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotSwallowExceptionOnClose()
        public virtual void ShouldNotSwallowExceptionOnClose()
        {
            // Given
            doThrow(new Exception()).when(_fileA).close();
            doThrow(new Exception()).when(_fileB).close();

            Segments segments = new Segments(_fsa, _fileNames, _readerPool, _segmentFiles, _contentMarshal, _logProvider, -1);

            // When
            try
            {
                segments.Close();
                fail("should have thrown");
            }
            catch (Exception ex)
            {
                // Then
                Exception[] suppressed = ex.Suppressed;
                assertEquals(1, suppressed.Length);
                assertTrue(suppressed[0] is Exception);
            }
        }