예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldCalculateProgressForNestedMultipleParts()
        internal virtual void ShouldCalculateProgressForNestedMultipleParts()
        {
            // given
            PopulationProgress multiPart1 = multiple().add(single(1, 1), 1).add(single(1, 5), 1).build();               // should result in 60%

            assertEquals(0.6f, multiPart1.Progress);
            PopulationProgress multiPart2 = multiple().add(single(6, 10), 1).add(single(1, 5), 1).build();               // should result in 40%

            assertEquals(0.4f, multiPart2.Progress);

            // when
            PopulationProgress_MultiBuilder builder = multiple();
            PopulationProgress all = builder.Add(multiPart1, 1).add(multiPart2, 1).build();

            // then
            assertEquals(0.5, all.Progress);
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldAlwaysResultInFullyCompleted()
        internal virtual void ShouldAlwaysResultInFullyCompleted()
        {
            // given
            int partCount = Random.Next(5, 10);
            PopulationProgress_MultiBuilder builder = multiple();

            for (int i = 0; i < partCount; i++)
            {
                long total = Random.nextLong(10_000_000);
                builder.Add(single(total, total), Random.nextFloat() * Random.Next(1, 10));
            }
            PopulationProgress populationProgress = builder.Build();

            // when
            float progress = populationProgress.Progress;

            // then
            assertEquals(1f, progress);
        }
예제 #3
0
 public PopulationProgressAnonymousInnerClass(PopulationProgress_MultiBuilder outerInstance, float[] weightFactors)
 {
     this.outerInstance  = outerInstance;
     this._weightFactors = weightFactors;
 }