Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // To set this project up:
- // Go to Project -> Manage NuGet Packages
- // Install NUnit and NUnit3TestAdapter
- // Run any tests on the left in Test Explorer
- namespace Kata_Test_Template
- {
- // User solution
- using System;
- public class Kata
- {
- public static string HowMuchILoveYou(int nb_petals)
- {
- string[] choices = new string[] { "I love you", "a little", "a lot", "passionately", "madly", "not at all" };
- int petal = nb_petals % 6;
- return choices[petal];
- }
- }
- // User solution end
- // Needed to compile
- class Program
- {
- static void Main(string[] args)
- {
- }
- }
- }
- // Tests
- namespace Solution
- {
- using Kata_Test_Template;
- using NUnit.Framework;
- using System;
- using System.Collections.Generic;
- [TestFixture, Description("Petal Tests")]
- public class Test
- {
- public static IEnumerable<TestCaseData> TestCases
- {
- get
- {
- yield return new TestCaseData(7).Returns("I love you").SetName("Should return first element after full loop");
- yield return new TestCaseData(3).Returns("a lot").SetName("Should return third element");
- yield return new TestCaseData(6).Returns("not at all").SetName("Should return sixth element");
- }
- }
- [Test, TestCaseSource("TestCases")]
- public string FixedTest(int n) => Kata.HowMuchILoveYou(n);
- }
- }
- // End Tests
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement