David

David

  • NA
  • 5
  • 0

Unit tesing - Testing method without implementation of interface

Nov 2 2009 9:48 AM
Hello!

I need a fast answer :)

I have an interface and a method.  I want to know whether i can test my method without an implementation of the interface. Any ideas? Are there any usefull things when it comes to unit testing for this kind of stuff?


public interface ICalcStrategy
{
double Calculate(double amount);
}

public static class NumberCalculation
{
public static double[] CalculateTaxes(double[] numbers, ICalcStrategy calcStrategy)
{
double[] result = new double[numbers.Length];

for (int i = 0; i < numbers.Length; i++)
result[i] = calcStrategy.Calculate(numbers[i]);

return result;
}
}

It would be great if someone could help me with this!

Answers (4)