Skip to content

Commit 5e85bc4

Browse files
committed
added unit tests for changes
1 parent ab8ca7b commit 5e85bc4

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Reflection;
2+
using Shouldly;
3+
using Xunit;
4+
5+
namespace TestStack.BDDfy.Tests.Scanner.FluentScanner
6+
{
7+
public class AmbiguousHeaderMatchTests
8+
{
9+
private int _count;
10+
11+
[Fact]
12+
public void ThrowsWhenMultipleHeadersMatchParameterName()
13+
{
14+
// Act & Assert
15+
var exception = Should.Throw<AmbiguousMatchException>(() =>
16+
{
17+
this.Given(_ => GivenInput(_count)) // Will try to bind _count to both "count" and "Count" headers
18+
.WithExamples(new ExampleTable("count", "Count") // Deliberately ambiguous headers
19+
{
20+
{ 5, 10 }
21+
})
22+
.BDDfy();
23+
});
24+
25+
exception.Message.ShouldBe("More than one headers for examples, match the parameter 'count' provided for 'GivenInput'");
26+
}
27+
28+
private void GivenInput(int count)
29+
{
30+
// The method exists just to trigger the ambiguous header match
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)