Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. // To set this project up:
  2. // Go to Project -> Manage NuGet Packages
  3. // Install NUnit and NUnit3TestAdapter
  4. // Run any tests on the left in Test Explorer
  5.  
  6. namespace Kata_Test_Template
  7. {
  8. // User solution
  9.  
  10. using System;
  11.  
  12. public class Kata
  13. {
  14. public static string HowMuchILoveYou(int nb_petals)
  15. {
  16. string[] choices = new string[] { "I love you", "a little", "a lot", "passionately", "madly", "not at all" };
  17. int petal = nb_petals % 6;
  18. return choices[petal];
  19. }
  20. }
  21.  
  22. // User solution end
  23.  
  24. // Needed to compile
  25. class Program
  26. {
  27. static void Main(string[] args)
  28. {
  29. }
  30. }
  31. }
  32.  
  33. // Tests
  34.  
  35. namespace Solution
  36. {
  37. using Kata_Test_Template;
  38. using NUnit.Framework;
  39. using System;
  40. using System.Collections.Generic;
  41.  
  42. [TestFixture, Description("Petal Tests")]
  43. public class Test
  44. {
  45. public static IEnumerable<TestCaseData> TestCases
  46. {
  47. get
  48. {
  49. yield return new TestCaseData(7).Returns("I love you").SetName("Should return first element after full loop");
  50. yield return new TestCaseData(3).Returns("a lot").SetName("Should return third element");
  51. yield return new TestCaseData(6).Returns("not at all").SetName("Should return sixth element");
  52.  
  53. }
  54. }
  55.  
  56. [Test, TestCaseSource("TestCases")]
  57. public string FixedTest(int n) => Kata.HowMuchILoveYou(n);
  58. }
  59. }
  60.  
  61. // End Tests
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement