Beispiel #1
0
        public void ShouldReturnANonEmptyString(string friendName)
        {
            // When
            var result = HelloSolution.Hello(friendName);

            Assert.IsFalse(string.IsNullOrEmpty(result));
        }
Beispiel #2
0
        public void GivenAFriendlyNameShouldReturnAPersonalisedHello(string name, string expected)
        {
            // ACT
            var result = HelloSolution.Hello(name);

            // ASSERT
            Assert.AreEqual(expected, result);
        }
        public string SayHello(string name)
        {
            var result = HelloSolution.Hello(name);

            Assert.AreEqual("Hello, John!", result);

            return(result);
        }
Beispiel #4
0
        public void ShouldReturnCorrectOutput(string friendName)
        {
            // When
            var result = HelloSolution.Hello(friendName);

            // Then
            Assert.AreEqual($"Hello, {friendName}!", result);
        }
Beispiel #5
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);
 }
        /// <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();
        }
Beispiel #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
        ///        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();
        }
Beispiel #8
0
 public void ResponseShouldContainParam(string param)
 {
     Assert.True(HelloSolution.Hello(param).IndexOf(param, StringComparison.CurrentCultureIgnoreCase) > -1);
 }
Beispiel #9
0
 public void ResponseShouldEndWithExclamation(string param)
 {
     Assert.True(HelloSolution.Hello(param).EndsWith("!"));
 }
 public string ReturnStringTest(string name)
 {
     return(HelloSolution.Hello(name));
 }
 public string TestHello(string friendName)
 {
     return(HelloSolution.Hello(friendName));
 }
Beispiel #12
0
 public string TestMessageTwo(string name)
 {
     return(HelloSolution.Hello(name));
 }
Beispiel #13
0
 public string ComputeHello(string input)
 {
     return(HelloSolution.Hello(input));
 }
Beispiel #14
0
 public string ComputeGreeting(string x)
 {
     return(HelloSolution.Hello(x));
 }
Beispiel #15
0
 public void ShouldThrowAnExceptionWhenFriendNameIsNullOrEmpty(string friendName)
 {
     // When - Then
     Assert.Throws <ArgumentException>(() => HelloSolution.Hello(friendName), $"Invalid parameter\r\nParameter name: friendName");
 }
Beispiel #16
0
        public void Hello()
        {
            string friendName = System.Guid.NewGuid().ToString();

            Assert.AreEqual(("Hello, " + friendName + "!"), HelloSolution.Hello(friendName));
        }
Beispiel #17
0
 public string SayHello(string friendsName)
 {
     return(HelloSolution.Hello(friendsName));
 }
Beispiel #18
0
 public void HelloWhitespaceParameter()
 {
     Assert.Throws <System.ArgumentNullException>(() => HelloSolution.Hello(" "));
 }
Beispiel #19
0
 public void HelloEmptyParameter()
 {
     Assert.Throws <System.ArgumentNullException>(() => HelloSolution.Hello(string.Empty));
 }
Beispiel #20
0
 public void HelloNullParameter()
 {
     Assert.Throws <System.ArgumentNullException>(() => HelloSolution.Hello(null));
 }
Beispiel #21
0
 public void Hello()
 {
     Assert.That(HelloSolution.Hello("my Friend"), Is.EqualTo("Hello, my Friend!"));
 }
Beispiel #22
0
 public void TheCorrectGreetingIsGivenWithTheFriendsName(string friendName)
 {
     Assert.That(HelloSolution.Hello(friendName), Is.EqualTo($"Hello, {friendName}!"));
 }
 public static string DisplayHelloWorld(string friendName)
 {
     return(HelloSolution.Hello(friendName));
 }
Beispiel #24
0
 public string ComputeSum(string friendName)
 {
     return(HelloSolution.Hello(friendName));
 }
Beispiel #25
0
 public string HellowWorld(string friendName)
 {
     return(HelloSolution.Hello(friendName));
 }
Beispiel #26
0
 public void WeGreetTheWorldIfThereIsNoName(string friendName)
 {
     Assert.That(HelloSolution.Hello(friendName), Is.EqualTo($"Hello, World!"));
 }