I am writing some integration tests for a c# .net core api we have using specflow. So far everything is going well but I have come across an issue that's driving me mad. I have the following couple of scenarios:
Scenario: Test 1
Given I am ready
When I update invoice 1 of customer 2
The method for this is defined as follows:
[When(@"I update invoice (.*) of customer (.*)]
public async Task UpdateInvoiceCustomer(int invoiceId, int customerId)......
The second scenario looks as follows:
Scenario: Test 1
Given I am ready
When I update invoice 1 of customer 2 to ready
The method for this is defined as follows:
[When(@"I update invoice (.*) of customer (.*) to (.*)]
public async Task UpdateInvoiceCustomerStatus(int invoiceId, int customerId, string status)......
The problem I have is that VS cannot distinguish between the two and keeps trying to run test 2 against test 1 c# code and failing as its trying to convert the string "1 to active" to a number. I think there must be a way to detect there are three parameters or to even inform specflow that the string contains int, int, string not int, int but I'm struggling. As an aside, I can get around this by rewording the string - I don't want to though as there must be a solution out there?