コード例 #1
0
        public void MultiplyOfFiveReturnsBuzz(int number)
        {
            string expected = FizzBuzzSolution.BUZZ;
            string actual   = FizzBuzzSolution.FizzBuzz(number);

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void NumberFifteenReturnsFizzBuzz(int number)
        {
            string expected = "FizzBuzz";
            string actual   = FizzBuzzSolution.FizzBuzz(number);

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void NumberTwoReturnsTwoAsString()
        {
            string expected = "2";
            string actual   = FizzBuzzSolution.FizzBuzz(2);

            Assert.AreEqual(expected, actual);
        }
コード例 #4
0
        static void Main(string[] args)
        {
            // Call the induvidual coding challanges
            Console.WriteLine("Coding Challange: FizzBuzz");
            _fizzBuzzSolution.FizzBuzz();
            Console.WriteLine("\r\nfrom array:");
            _fizzBuzzSolution.FizzBuzzArray();
            Console.WriteLine("\r\nfrom list:");
            _fizzBuzzSolution.FizzBuzzList();
            Console.WriteLine("\r\n***********************************");
            Console.WriteLine("");

            Console.WriteLine("Coding Challange: Palindrome");
            Console.WriteLine("Array.Reverse:");
            Console.WriteLine("The word Vidarradiv is a palindrome : " + _palindromeSolution.Palindrome("Vidarradiv"));
            Console.WriteLine("While loop:");
            _palindromeSolution.PalindromeWhile("Vidarradiv");
            Console.WriteLine("\r\n***********************************");
            Console.WriteLine("");

            Console.WriteLine("Coding challange: UserInput");
            Console.Write("UserInput should print out 10. And it printed out -> ");
            _userInputSolution.UserInterface();
            Console.WriteLine("\r\n***********************************");
            Console.WriteLine("");

            Console.WriteLine("Coding Challenge : Multiplier of 3 and 5");
            Console.WriteLine("Natural numbers below 10");
            _multiplierOf3And5.naturalNumbersBelow10();
            Console.WriteLine("\r\nNatural numbers below 1000");
            _multiplierOf3And5.naturalNumbersBelow1000();
            Console.WriteLine("\r\n***********************************");
            Console.WriteLine("");

            Console.WriteLine("Coding Challenge : Even Fibonacci numbers");
            _evenFibonaccciNumbers.EvenFibonacciSquence4M();
            Console.WriteLine("\r\n***********************************");
            Console.WriteLine("");

            Console.WriteLine("Coding Challenge : Largest prime factor");
            _largetPrimeFactor.FindLargestPrimeFactor();
            Console.WriteLine("\r\n***********************************");
            Console.WriteLine("");

            // Console.WriteLine("Coding Challenge : blabla");
            // int[] numbers = {-1, 2, 10, 5, 100, -10, -100 , 0};
            // _sum.sumTwoSmallestNumbers(numbers);
            // Console.WriteLine("\r\n***********************************");
            // Console.WriteLine("");

            //  Console.WriteLine("Coding Challenge : towerBuild");

            var ts = new List <int> {
                91, 74, 73, 85, 73, 81, 87
            };

            Console.Write(_stop.SongDecoder("RWUBWUBWUBLWUB"));
            Console.WriteLine("\r\n***********************************");
            Console.WriteLine("");
        }
コード例 #5
0
        public void NumberOneReturnsOneAsString()
        {
            string expected = "1";
            string actual   = FizzBuzzSolution.FizzBuzz(1);

            Assert.AreEqual(expected, actual);
        }
コード例 #6
0
        public void NumberFourReturnsFourAsString()
        {
            string expected = "4";
            string actual   = FizzBuzzSolution.FizzBuzz(4);

            Assert.AreEqual(expected, actual);
        }
コード例 #7
0
 /// <summary>
 /// ~~~~~~~~~~ Running the system: ~~~~~~~~~~~~~
 ///
 ///   From IDE:
 ///      Configure the "BeFaster.App" solution to Run on External Console then run.
 ///
 ///   From command line:
 ///      msbuild befaster.sln; src\BeFaster.App\bin\Debug\BeFaster.App.exe
 ///
 ///   To run your unit tests locally:
 ///      Run the "BeFaster.App.Tests - Unit Tests" configuration.
 ///
 /// ~~~~~~~~~~ The workflow ~~~~~~~~~~~~~
 ///
 ///   By running this file you interact with a challenge server.
 ///   The interaction follows a request-response pattern:
 ///        * You are presented with your current progress and a list of actions.
 ///        * You trigger one of the actions by typing it on the console.
 ///        * After the action feedback is presented, the execution will stop.
 ///
 ///   +------+-------------------------------------------------------------+
 ///   | Step | The usual workflow                                          |
 ///   +------+-------------------------------------------------------------+
 ///   |  1.  | Run this file.                                              |
 ///   |  2.  | Start a challenge by typing "start".                        |
 ///   |  3.  | Read description from the "challenges" folder               |
 ///   |  4.  | Implement the required method in                            |
 ///   |      |   .\src\BeFaster.App\Solutions                              |
 ///   |  5.  | Deploy to production by typing "deploy".                    |
 ///   |  6.  | Observe output, check for failed requests.                  |
 ///   |  7.  | If passed, go to step 3.                                    |
 ///   +------+-------------------------------------------------------------+
 ///
 /// </summary>
 /// <param name="args">Action.</param>
 private static void Main(string[] args)
 {
     ClientRunner
     .ForUsername(CredentialsConfigFile.Get("tdl_username"))
     .WithServerHostname(CredentialsConfigFile.Get("tdl_hostname"))
     .WithActionIfNoArgs(RunnerAction.TestConnectivity)
     .WithSolutionFor("sum", p => SumSolution.Sum(p[0].AsInt(), p[1].AsInt()))
     .WithSolutionFor("hello", p => HelloSolution.Hello(p[0]))
     .WithSolutionFor("fizz_buzz", p => FizzBuzzSolution.FizzBuzz(p[0].AsInt()))
     .WithSolutionFor("checkout", p => CheckoutSolution.Checkout(p[0]))
     .Start(args);
 }
コード例 #8
0
        /// <summary>
        /// ~~~~~~~~~~ Running the system: ~~~~~~~~~~~~~
        ///
        ///   From IDE:
        ///      Configure the "BeFaster.App" solution to Run on External Console then run.
        ///
        ///   From command line:
        ///      msbuild befaster.sln; src\BeFaster.App\bin\Debug\BeFaster.App.exe
        ///
        ///   To run your unit tests locally:
        ///      Run the "BeFaster.App.Tests - Unit Tests" configuration.
        ///
        /// ~~~~~~~~~~ The workflow ~~~~~~~~~~~~~
        ///
        ///   By running this file you interact with a challenge server.
        ///   The interaction follows a request-response pattern:
        ///        * You are presented with your current progress and a list of actions.
        ///        * You trigger one of the actions by typing it on the console.
        ///        * After the action feedback is presented, the execution will stop.
        ///
        ///   +------+-------------------------------------------------------------+
        ///   | Step | The usual workflow                                          |
        ///   +------+-------------------------------------------------------------+
        ///   |  1.  | Run this file.                                              |
        ///   |  2.  | Start a challenge by typing "start".                        |
        ///   |  3.  | Read description from the "challenges" folder               |
        ///   |  4.  | Implement the required method in                            |
        ///   |      |   .\src\BeFaster.App\Solutions                              |
        ///   |  5.  | Deploy to production by typing "deploy".                    |
        ///   |  6.  | Observe output, check for failed requests.                  |
        ///   |  7.  | If passed, go to step 3.                                    |
        ///   +------+-------------------------------------------------------------+
        ///
        ///   You are encouraged to change this project as you please:
        ///        * You can use your preferred libraries.
        ///        * You can use your own test framework.
        ///        * You can change the file structure.
        ///        * Anything really, provided that this file stays runnable.
        ///
        /// </summary>
        /// <param name="args">Action.</param>
        private static void Main(string[] args)
        {
            var runner = new QueueBasedImplementationRunner.Builder()
                         .SetConfig(Utils.GetRunnerConfig())
                         .WithSolutionFor("sum", p => SumSolution.Sum(p[0].AsInt(), p[1].AsInt()))
                         .WithSolutionFor("hello", p => HelloSolution.Hello(p[0]))
                         .WithSolutionFor("fizz_buzz", p => FizzBuzzSolution.FizzBuzz(p[0].AsInt()))
                         .WithSolutionFor("checkout", p => CheckoutSolution.Checkout(p[0]))
                         .Create();

            ChallengeSession.ForRunner(runner)
            .WithConfig(Utils.GetConfig())
            .WithActionProvider(new UserInputAction(args))
            .Start();

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey();
        }
コード例 #9
0
        /// <summary>
        /// ~~~~~~~~~~ Running the system: ~~~~~~~~~~~~~
        ///
        ///   From IDE:
        ///      Configure the "BeFaster.App" solution to Run on External Console then run.
        ///
        ///   From command line:
        ///      msbuild befaster.sln; src\BeFaster.App\bin\Debug\BeFaster.App.exe
        ///        or
        ///      msbuild befaster.sln; mono src/BeFaster.App/bin/Debug/BeFaster.App.exe
        ///
        ///   To run your unit tests locally:
        ///      Run the "BeFaster.App.Tests - Unit Tests" configuration.
        ///
        /// ~~~~~~~~~~ The workflow ~~~~~~~~~~~~~
        ///
        ///   By running this file you interact with a challenge server.
        ///   The interaction follows a request-response pattern:
        ///        * You are presented with your current progress and a list of actions.
        ///        * You trigger one of the actions by typing it on the console.
        ///        * After the action feedback is presented, the execution will stop.
        ///
        ///   +------+-------------------------------------------------------------+
        ///   | Step | The usual workflow                                          |
        ///   +------+-------------------------------------------------------------+
        ///   |  1.  | Run this file.                                              |
        ///   |  2.  | Start a challenge by typing "start".                        |
        ///   |  3.  | Read description from the "challenges" folder               |
        ///   |  4.  | Implement the required method in                            |
        ///   |      |   .\src\BeFaster.App\Solutions                              |
        ///   |  5.  | Deploy to production by typing "deploy".                    |
        ///   |  6.  | Observe output, check for failed requests.                  |
        ///   |  7.  | If passed, go to step 3.                                    |
        ///   +------+-------------------------------------------------------------+
        ///
        ///   You are encouraged to change this project as you please:
        ///        * You can use your preferred libraries.
        ///        * You can use your own test framework.
        ///        * You can change the file structure.
        ///        * Anything really, provided that this file stays runnable.
        ///
        /// </summary>
        /// <param name="args">Action.</param>
        private static void Main(string[] args)
        {
            var runner = new QueueBasedImplementationRunner.Builder().
                         SetConfig(Utils.GetRunnerConfig()).
                         WithSolutionFor("sum", (List <JToken> p) => SumSolution.Sum(p[0].ToObject <int>(), p[1].ToObject <int>())).
                         WithSolutionFor("hello", (List <JToken> p) => HelloSolution.Hello(p[0].ToObject <string>())).
                         WithSolutionFor("array_sum", (List <JToken> p) => ArraySumSolution.Compute((p[0].ToObject <List <int> >()))).
                         WithSolutionFor("int_range", (List <JToken> p) => IntRangeSolution.Generate(p[0].ToObject <int>(), p[1].ToObject <int>())).
                         WithSolutionFor("fizz_buzz", (List <JToken> p) => FizzBuzzSolution.FizzBuzz(p[0].ToObject <int>())).
                         WithSolutionFor("checkout", (List <JToken> p) => CheckoutSolution.Checkout(p[0].ToObject <string>())).
                         Create();

            ChallengeSession.ForRunner(runner)
            .WithConfig(Utils.GetConfig())
            .WithActionProvider(new UserInputAction(args))
            .Start();

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey();
        }
コード例 #10
0
 public string TestForDefault(int x)
 {
     return(FizzBuzzSolution.FizzBuzz(x));
 }
コード例 #11
0
 public string FizzBuzzFakeDeluxeTrue(int input)
 {
     return(FizzBuzzSolution.FizzBuzz(input));
 }
コード例 #12
0
 public string BuzzTestTrue(int input)
 {
     return(FizzBuzzSolution.FizzBuzz(input));
 }
コード例 #13
0
 public string FizzDeluxeTrueTest(int input)
 {
     return(FizzBuzzSolution.FizzBuzz(input));
 }
コード例 #14
0
 public string FizzBuzzTest_NumIsMultiply(int num)
 {
     return(FizzBuzzSolution.FizzBuzz(num));
 }
コード例 #15
0
 public string FizzBuzzDeluxeTest(int number)
 {
     return(FizzBuzzSolution.FizzBuzz(number));
 }
コード例 #16
0
 public string BuzzContainerTest(int number)
 {
     return(FizzBuzzSolution.FizzBuzz(number));
 }
コード例 #17
0
 public string TestForNumberContains5(int x)
 {
     return(FizzBuzzSolution.FizzBuzz(x));
 }
コード例 #18
0
 public string FizzBuzzByContainerBuzzByDivisibleFizzTest(int number)
 {
     return(FizzBuzzSolution.FizzBuzz(number));
 }
コード例 #19
0
 public string TestFizzBuzz(int number)
 {
     return(FizzBuzzSolution.FizzBuzz(number));
 }
コード例 #20
0
        public string FizzBuzzDeluxFake(int number)
        {
            var result = FizzBuzzSolution.FizzBuzz(number);

            return(result);
        }
コード例 #21
0
        public string DivisableByThreeAndFiveReturnsFizzOtherwiseNumber(int number)
        {
            var result = FizzBuzzSolution.FizzBuzz(number);

            return(result);
        }
コード例 #22
0
 public string TestFizzOne(int suppliedNumber)
 {
     return(FizzBuzzSolution.FizzBuzz(suppliedNumber));
 }
コード例 #23
0
 public string TestForMultipleOf5(int x)
 {
     return(FizzBuzzSolution.FizzBuzz(x));
 }
コード例 #24
0
 public string BuzzNoDeluxeNumberLessThan10Test(int number)
 {
     return(FizzBuzzSolution.FizzBuzz(number));
 }
コード例 #25
0
 public string TestForNumberMultipleOf3AndContains5(int x)
 {
     return(FizzBuzzSolution.FizzBuzz(x));
 }
コード例 #26
0
 public string NumberLessThan1000Test(int number)
 {
     return(FizzBuzzSolution.FizzBuzz(number));
 }
コード例 #27
0
 public string TestForFizzBuzzDeluxe(int x)
 {
     return(FizzBuzzSolution.FizzBuzz(x));
 }
コード例 #28
0
 public string FakeFizzDeluxeLessThan1000Test(int number)
 {
     return(FizzBuzzSolution.FizzBuzz(number));
 }