public void ShouldReturnANonEmptyString(string friendName) { // When var result = HelloSolution.Hello(friendName); Assert.IsFalse(string.IsNullOrEmpty(result)); }
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); }
public void ShouldReturnCorrectOutput(string friendName) { // When var result = HelloSolution.Hello(friendName); // Then Assert.AreEqual($"Hello, {friendName}!", result); }
/// <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(); }
/// <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(); }
public void ResponseShouldContainParam(string param) { Assert.True(HelloSolution.Hello(param).IndexOf(param, StringComparison.CurrentCultureIgnoreCase) > -1); }
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)); }
public string TestMessageTwo(string name) { return(HelloSolution.Hello(name)); }
public string ComputeHello(string input) { return(HelloSolution.Hello(input)); }
public string ComputeGreeting(string x) { return(HelloSolution.Hello(x)); }
public void ShouldThrowAnExceptionWhenFriendNameIsNullOrEmpty(string friendName) { // When - Then Assert.Throws <ArgumentException>(() => HelloSolution.Hello(friendName), $"Invalid parameter\r\nParameter name: friendName"); }
public void Hello() { string friendName = System.Guid.NewGuid().ToString(); Assert.AreEqual(("Hello, " + friendName + "!"), HelloSolution.Hello(friendName)); }
public string SayHello(string friendsName) { return(HelloSolution.Hello(friendsName)); }
public void HelloWhitespaceParameter() { Assert.Throws <System.ArgumentNullException>(() => HelloSolution.Hello(" ")); }
public void HelloEmptyParameter() { Assert.Throws <System.ArgumentNullException>(() => HelloSolution.Hello(string.Empty)); }
public void HelloNullParameter() { Assert.Throws <System.ArgumentNullException>(() => HelloSolution.Hello(null)); }
public void Hello() { Assert.That(HelloSolution.Hello("my Friend"), Is.EqualTo("Hello, my Friend!")); }
public void TheCorrectGreetingIsGivenWithTheFriendsName(string friendName) { Assert.That(HelloSolution.Hello(friendName), Is.EqualTo($"Hello, {friendName}!")); }
public static string DisplayHelloWorld(string friendName) { return(HelloSolution.Hello(friendName)); }
public string ComputeSum(string friendName) { return(HelloSolution.Hello(friendName)); }
public string HellowWorld(string friendName) { return(HelloSolution.Hello(friendName)); }
public void WeGreetTheWorldIfThereIsNoName(string friendName) { Assert.That(HelloSolution.Hello(friendName), Is.EqualTo($"Hello, World!")); }