Exemplo n.º 1
0
        public void WhenThenFromFile(string fileName, int expected)
        {
            var s = @"C:\Users\ali.abdoli\source\repos\AlgorithmHackerrank\AlgorithmHackerrank.Tests\Sorting\" + fileName;
            //var expectedDir = @"C:\Users\ali.abdoli\source\repos\AlgorithmHackerrank\AlgorithmHackerrank.Tests\"+ fileName;

            var reader = new StreamReader(s);
            //var expectedReader = new StreamReader(expectedDir);

            var algorithm = new FraudulentActivityNotifications();

            string[] nd = reader.ReadLine().Split(' ');

            int n = Convert.ToInt32(nd[0]);

            int d = Convert.ToInt32(nd[1]);


            int[] expenditure = Array.ConvertAll(reader.ReadLine().Split(' '),
                                                 expenditureTemp => Convert.ToInt32(expenditureTemp));


            int result = algorithm.ActivityNotifications(expenditure, d);

            Assert.AreEqual(expected, result);
        }
Exemplo n.º 2
0
        public void WhenThen(string input, int expected)
        {
            var algorithm = new FraudulentActivityNotifications();
            var reader    = new StringReader(input);

            string[] nd = reader.ReadLine().Split(' ');

            int n = Convert.ToInt32(nd[0]);

            int d = Convert.ToInt32(nd[1]);

            int[] expenditure = Array.ConvertAll(reader.ReadLine().Split(' '),
                                                 expenditureTemp => Convert.ToInt32(expenditureTemp));
            int result = algorithm.ActivityNotifications(expenditure, d);

            Assert.AreEqual(expected, result);
        }