MudassarRasool / mb-unit

Automatically exported from code.google.com/p/mb-unit
0 stars 0 forks source link

DataBindingException when there is an unbound test parameter with a default value. #691

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a test method with 3 parameters. Let the last parameter have a 
default value.
2. Attribute the test method with the Factory attribute, connecting the test to 
a factory method.
3. Let the factory method yield the values for the first two parameters of the 
test, leaving the third parameter unbound.
4. Run the test.

What is the expected output? What do you see instead?
The factory method provides the values for the first two parameters, the third 
parameter is unbound, but it has a default value. I expected, that the test 
method be called with the default value in the last parameter.
Instead, I get this:
Gallio.Framework.Data.DataBindingException occurred
  Message=Binding index not available or out of range.
Attempted binding: Binding Index: 2, Path: 'offset'
  Source=Gallio
  StackTrace:
       at Gallio.Framework.Data.ListDataItem`1.GetValueImpl(DataBinding binding) in c:\Server\Projects\MbUnit v3.2\Work\src\Gallio\Gallio\Framework\Data\ListDataItem.cs:line 61
  InnerException: 

What version of the product are you using? On what operating system?
Version 3.2 build 517

Please provide any additional information below.
For instance:

public static IEnumerable<object[]> YieldCompactTimeSpanStrings()
{
  yield return new object[] { new TimeSpan(0, 0, 0), "0s" };
}

[Test, Factory("YieldCompactTimeSpanStrings")]
public static void TimeSpanFromCompactString(TimeSpan expected, string input, 
int offset = 0)
{
}

Of course, I can workaround the bug by attributing the offset parameter with 
[Column(0)], though I think that the Gallio engine should treat the default 
parameters gracefully.

Original issue reported on code.google.com by mark.kha...@gmail.com on 25 Jul 2010 at 6:31

GoogleCodeExporter commented 8 years ago
Gallio binding service to support gracefully .Net 4 optional parameters.

Original comment by Yann.Tre...@gmail.com on 12 Aug 2010 at 6:01

GoogleCodeExporter commented 8 years ago

Original comment by Yann.Tre...@gmail.com on 14 Jun 2011 at 5:53