Say I have a domain object like this:
public class Customer
{
private Guid _id;
private string _name;
private Address _address;
public Customer (Guid id, string name, Address address)
{
if (id == Guid.Empty)
throw new ArgumentException();
if (name == "")
throw new ArgumentException();
if (address == null)
throw new ArgumentException();
_id = id;
_address = address;
_name= name;
}
}
I want to create some Specflow scenarios to test this. So far I have done (Specflow scenario in feature file):
Given a name of Bert and an address of 1 The street, London, Greater London, L1 234
This Specflow scenario looks ok to me, however I am conscious that I am missing out the ID. The ID is created inside the test method. Should I be doing this instead (specflow scenario in feature file):
Given a name of Bert and an address of 1 The street, London, Greater London, L1 234 and an id of 111-11-1111-11
The first approach (without the ID) looks correct to me. Am I right here? If I use the first approach, then how would I create a scenario to test for an empty ID?
Every single example I look at online shows how to apply Specflow to a simple Calculator or game. None of these classes have or need IDs.