We have a bug indicating that the following doesn't work...
[Datapoint]
public double[,] Array2X2 = new double[,] { { 1, 0 }, { 0, 1 } };
[Theory]
public void TestForArbitraryArray<T>(T[,] array)
{
...
}
That's understandable, because the Datapoints are required to exactly match the
argument type and double[,] is not an _exact_ match for T[,], even
though it would
a proper match when calling the method. The problem is that there can never be
an exact match for this argument, since Datapoints will always be of some
particular type rather than generic.
I'm inclined not to support this. I'm at a loss to think of a good use
case and it
seems to open up the possibility of a Theory that eats up any
datapoint whatsoever,
like this one...
[Theory]
public void TestForAnythingWhatsoevery<T>(T theThing)
{
...
}
Any thoughts on this?
Charlie
--
You received this message because you are subscribed to the Google Groups "NUnit-Discuss" group.
To post to this group, send email to nunit-...@googlegroups.com.
To unsubscribe from this group, send email to nunit-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nunit-discuss?hl=en.
Charlie
[TestFixture]
public class GenomeSeries{
//private static string s = "AT<GC>,A<TA>";
private static GenomeSeries genomeObject = new GenomeSeries();
[Datapoints]
private string[] patternGeneration = genomeObject.GenerateData(s);
// GenerateData method returns the below strings
//private static string[] pattern = new string[4] { "ATGAT", "ATGAA", "ATCAT", "ATCAA" };
[Theory]
public void GenerateGenomeSequence(string x){
Assume.That(x == "ATGAT" || x == "ATGAA" || x == "ATCAT" || x == "ATCAA");
}}
// AT<GC>", "A<TA>
// Adenine, Guanine, Cytosine, Thianine,
Yes, but the Datapoint is still a field, which is initialized by your
method. The
future extension I was writing about would allow you to write...
[Datapoints]
string[] GenerateGenomeData()
{
yield return "ATGAT";
yield return "ATGAA";
yield return "ATCAT";
yield return "ATCAA";
}
or perhaps something a little more sophisticated. :-)
Charlie
Charlie
I like the idea of a theory that can take any object. Seems like that
might be good for writing tests of things like conversion tostring,
streaming to disk and reading back from disk, equality and other base
level functionality that you might want in all of your objects.
I don't use generics enough to have a good feeling as to whether the
above would be directly useful, but if all your generics subclassed a
base class, then you could write a Theory for that base class... just
a thought.
-Kelly