Is it possible to write a TestDataBuilder which follows a given syntax?
So for example:
I know how to write a basic builder for a car that's not the problem.
But how can I achieve, that I can only add new windows to a door?
So this is allowed:
var car = CarBuilderWithSyntax.Create()
.WithDoor()
.HavingSide(Sides.Left)
.WithWindow()
.HavingWidth(50)
.HavingHeight(50)
.Build();
But this is not allowed:
var car = CarBuilderWithSyntax.Create()
.WithWindow()
.HavingWidth(50)
.HavingHeight(50)
.Build();
Is there a possibility to enforce this syntax-rule?
Aucun commentaire:
Enregistrer un commentaire