public void Problem17_ShouldReturn_21124()
 {
     Assert.Throws <NotImplementedException>(() =>
     {
         Problem17.GetResult();
     });
 }
Example #2
0
        public void TestMethod1()
        {
            Problem17 p = new Problem17();

            int len = p.GetAbsolutePath("dir\n\tsubdir1\n\t\tfile1.ext\n\t\tsubsubdir1\n\tsubdir2\n\t\tsubsubdir2\n\t\t\tfile2.ext");

            Assert.AreEqual(32, len);
        }
Example #3
0
        public void Test_Problem17_Numbers1_1000()
        {
            int letterCount     = 0;
            var problem17Solver = new Problem17();

            for (int i = 1; i <= 1000; i++)
            {
                letterCount += problem17Solver.GetLetterCount(i);
            }
            Assert.AreEqual(19, letterCount);
        }
Example #4
0
        public void Test17(int n)
        {
            string expected = Enumerable.Range(1, n).Aggregate(1, (p, item) => p * item).ToString();

            using (var sw = new StringWriter())
            {
                using (var sr = new StringReader($"{n}"))
                {
                    Console.SetIn(sr);
                    Console.SetOut(sw);
                    Problem17.Main();
                }
                string result = sw.ToString().Trim();

                Assert.AreEqual(expected, result);
            }
        }
        public void Problem17_Return_Result_21124()
        {
            long act = Problem17.NumberLetterCounts();

            Assert.True(act.Equals(21124));
        }
Example #6
0
 static void Main(string[] args)
 {
     Problem17.Part1();
     Problem17.Part2();
 }