Exemplo n.º 1
0
        public void TestGetPrimeFactors(double value, IEnumerable <double> expectedResult)
        {
            var sut = new LargestPrimeFactor();

            List <double> actualResult = sut.GetPrimeFactors(value);

            Assert.True(actualResult.SequenceEqual(expectedResult));
        }
Exemplo n.º 2
0
        public void TestIsPrimeNumber(int value, bool expectedResult)
        {
            var sut = new LargestPrimeFactor();

            bool actualResult = sut.IsPrimeNumber(value);

            Assert.Equal(expectedResult, actualResult);
        }
Exemplo n.º 3
0
        public void ShowResult()
        {
            var sut = new LargestPrimeFactor();

            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            const double  testValue    = 600851475143;
            List <double> actualResult = sut.GetPrimeFactors(testValue);

            stopwatch.Stop();

            _output.WriteLine("Time spent on calculation: {0}", stopwatch.Elapsed);
            _output.WriteLine("LargestPrimeFactor for {0}: {1}", testValue, actualResult[actualResult.Count - 1]);
        }