Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAllowStartingAPartBeforeCompletionOfMultiPartBuilder()
        public virtual void ShouldAllowStartingAPartBeforeCompletionOfMultiPartBuilder()
        {
            // given
            Indicator indicator = mock(typeof(Indicator));

            ProgressMonitorFactory.MultiPartBuilder builder = Factory.mock(indicator, 10).multipleParts(TestName.MethodName);
            ProgressListener part1 = builder.ProgressForPart("part1", 1);
            ProgressListener part2 = builder.ProgressForPart("part2", 1);

            // when
            part1.Add(1);
            builder.Build();
            part2.Add(1);
            part1.Done();
            part2.Done();

            // then
            InOrder order = inOrder(indicator);

            order.verify(indicator).startPart("part1", 1);
            order.verify(indicator).startProcess(2);
            order.verify(indicator).startPart("part2", 1);
            order.verify(indicator).completePart("part1");
            order.verify(indicator).completePart("part2");
            order.verify(indicator).completeProcess();
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotAllowAddingMultiplePartsWithSameIdentifier()
        public virtual void ShouldNotAllowAddingMultiplePartsWithSameIdentifier()
        {
            ProgressMonitorFactory.MultiPartBuilder builder = Mockito.mock(typeof(ProgressMonitorFactory)).multipleParts(TestName.MethodName);
            builder.ProgressForPart("first", 10);

            Expected.expect(typeof(System.ArgumentException));
            Expected.expectMessage("Part 'first' has already been defined.");
            builder.ProgressForPart("first", 10);
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotAllowAddingPartsAfterCompletingMultiPartBuilder()
        public virtual void ShouldNotAllowAddingPartsAfterCompletingMultiPartBuilder()
        {
            ProgressMonitorFactory.MultiPartBuilder builder = Factory.mock(IndicatorMock(), 10).multipleParts(TestName.MethodName);
            builder.ProgressForPart("first", 10);
            builder.Build();

            Expected.expect(typeof(System.InvalidOperationException));
            Expected.expectMessage("Builder has been completed.");
            builder.ProgressForPart("other", 10);
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAggregateProgressFromMultipleProcesses()
        public virtual void ShouldAggregateProgressFromMultipleProcesses()
        {
            // given
            Indicator indicator = IndicatorMock();

            ProgressMonitorFactory.MultiPartBuilder builder = Factory.mock(indicator, 10).multipleParts(TestName.MethodName);
            ProgressListener first = builder.ProgressForPart("first", 5);
            ProgressListener other = builder.ProgressForPart("other", 5);

            builder.Build();
            InOrder order = inOrder(indicator);

            order.verify(indicator).startProcess(10);
            order.verifyNoMoreInteractions();

            // when
            first.Started();
            for (int i = 0; i < 5; i++)
            {
                first.Add(1);
            }
            first.Done();

            // then
            order.verify(indicator).startPart("first", 5);
            for (int i = 0; i < 5; i++)
            {
                order.verify(indicator).progress(i, i + 1);
            }
            order.verify(indicator).completePart("first");
            order.verifyNoMoreInteractions();

            // when
            other.Started();
            for (int i = 0; i < 5; i++)
            {
                other.Add(1);
            }
            other.Done();

            // then
            order.verify(indicator).startPart("other", 5);
            for (int i = 5; i < 10; i++)
            {
                order.verify(indicator).progress(i, i + 1);
            }
            order.verify(indicator).completePart("other");
            order.verify(indicator).completeProcess();
            order.verifyNoMoreInteractions();
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCompleteMultiPartProgressWithNoPartsImmediately()
        public virtual void ShouldCompleteMultiPartProgressWithNoPartsImmediately()
        {
            // given
            Indicator indicator = IndicatorMock();

            ProgressMonitorFactory.MultiPartBuilder builder = Factory.mock(indicator, 10).multipleParts(TestName.MethodName);

            // when
            builder.Build();

            // then
            InOrder order = inOrder(indicator);

            order.verify(indicator).startProcess(0);
            order.verify(indicator).progress(0, 10);
            order.verify(indicator).completeProcess();
            order.verifyNoMoreInteractions();
        }