예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowIfTheLogCannotBeRead() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldThrowIfTheLogCannotBeRead()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final EntryTimespanThreshold threshold = new EntryTimespanThreshold(clock, java.util.concurrent.TimeUnit.MILLISECONDS, 100);
            EntryTimespanThreshold threshold = new EntryTimespanThreshold(_clock, TimeUnit.MILLISECONDS, 100);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.io.IOException ex = new java.io.IOException();
            IOException ex = new IOException();

            when(_source.getFirstStartRecordTimestamp(_version)).thenThrow(ex);

            // when
            threshold.Init();
            try
            {
                threshold.Reached(_file, _version, _source);
                fail("should have thrown");
            }
            catch (Exception e)
            {
                // then
                assertEquals(ex, e.InnerException);
            }
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnReturnWhenTimeIsBeforeTheLowerLimit() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReturnReturnWhenTimeIsBeforeTheLowerLimit()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final EntryTimespanThreshold threshold = new EntryTimespanThreshold(clock, java.util.concurrent.TimeUnit.MILLISECONDS, 100);
            EntryTimespanThreshold threshold = new EntryTimespanThreshold(_clock, TimeUnit.MILLISECONDS, 100);

            when(_source.getFirstStartRecordTimestamp(_version)).thenReturn(800L);

            // when
            threshold.Init();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final boolean result = threshold.reached(file, version, source);
            bool result = threshold.Reached(_file, _version, _source);

            // then
            assertTrue(result);
        }