Reputation: 11
So I'm a java developer new to C# and I can't seem to get this trivial thing working. I have a Tests class which tests a method in another class. For convenience, I made these static so not to rely on any instantiation. For some reason though, my Tests class can't seem to find my Kata class.
namespace Codewars
{
public class Program
{
static void Main(string[] args)
{
}
public static string HoopCount(int n)
{
if (n >= 10)
{
return "Great, now move on to tricks";
}
else
{
return "Keep at it until you get it";
}
}
}
}
Test:
using NUnit.Framework;
namespace Codewars
{
[TestFixture]
class Tests
{
[Test]
public static void FixedTest()
{
Assert.AreEqual("Keep at it until you get it", Kata.HoopCount(6), "Should work for 6");
Assert.AreEqual("Great, now move on to tricks", Kata.HoopCount(22), "Should work for 22");
}
}
}
Upvotes: 0
Views: 459
Reputation: 3586
Your static method is declared inside Program, not Kata, so you should refer to it as Program.HoopCount(someint)
Upvotes: 2