using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
public static class Implementations
public static void GreenTea(int n)
for(int i=1; i <= n ; i++)
if(IsGreen(i) && IsTea(i))
Console.WriteLine("GreenTea");
Console.WriteLine("Green");
Console.WriteLine("Tea");
Console.WriteLine(i.ToString());
public static bool IsGreen(int n)
public static bool IsTea(int n)
public static IEnumerable<T> FirstHalf<T>(this IEnumerable<T> tt)
int mid = tt.Count() / 2;
public static void Main()
AssertGreenTeaIsCorrect(1020);
AssertGreenTeaIsCorrect(102);
AssertGreenTeaIsCorrect(10);
AssertGreenTeaIsCorrect(4);
AssertFirstHalfIsCorrect(new string [] { "North", "South", "East", "West" });
AssertFirstHalfIsCorrect(new string [] { "red", "green", "blue" });
Console.WriteLine("All tests succeeded.");
public static void AssertGreenTeaIsCorrect(int n)
Implementations.GreenTea(n);
public static void AssertFirstHalfIsCorrect(IEnumerable<string> tt)
var result = tt.FirstHalf().ToList();
var totalList = tt.ToList();
for(int i=0; i< totalList.Count()/2; i++)
Assert.AreEqual(result[i] , totalList[i]);