Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples not working when implemented in base class #253

Open
paulmarshall opened this issue Jun 8, 2017 · 2 comments
Open

Examples not working when implemented in base class #253

paulmarshall opened this issue Jun 8, 2017 · 2 comments

Comments

@paulmarshall
Copy link

I get the UnusedExampleValueException when trying to execute a test defined in a base class that includes a fluent based scenario incorporating an example.

In my setup my test fixture derives from a base class.
The base class includes a test and fields.
The test includes a fluent-based scenario that includes an example, and the headers of the examples match the name of the field(s) on the base class.

The test passed when there were no base classes.

@impeccable-tester
Copy link

Hi Paul can you post your example. Cheers.

@paulmarshall
Copy link
Author

In summary, the implementation is as follows:

public abstract class MapperTests
{
	private Request request;
	private Response response;
	private string input;

	[Test]
	public void CheckResponseIsOk()
	{
		this.Given(_, => _.A_Valid_Request())
			.When(_, => _.Map_Is_Called())
			.Then(_, => _.Result_Is_Ok())
			.WithExamples(new ExampleTable("input")
			{
				{"7"}
			})
			.BDDfy();	
	}

	private void A_Valid_Request()
	{
		this.request = new Request(this.input);
	}

	private void Map_Is_Called()
	{
		var mapper = CreateMapper();
		this.response = mapper.Map(this.request);
	}

	private void Result_Is_Ok()
	{
		this.response.Field.ShouldBe(this.input);
	}
}

[TestFixture]
public class SpecificMapperTests : MapperTests
{
	
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants