csf-dev / CSF.Screenplay

Implementation of the Screenplay pattern (aka Journey) in .NET
https://csf-dev.github.io/CSF.Screenplay/
MIT License
13 stars 1 forks source link

Consider including 'sample' integration config files in NuGet packages for NUnit and SpecFlow #123

Closed craigfowler closed 6 years ago

craigfowler commented 6 years ago

The packages for NUnit and SpecFlow could be enhanced by including a sample integration source file. This would be a .cs file which demonstrates how to write an integration and includes comments about how to set it up.

This should be considered, and it should be investigated as to whether this is a good idea or not. Perhaps a partial class with partial methods, so that it can be overwritten without consequence? Otherwise it would need to be controlled so that NuGet does not overwrite the file if it already exists. Or perhaps add it with a build action of None (so that there's no consequence of adding it).

Alternatively I could just show a README with a link to examples, so that there's no need to add anything into anybody's project.

craigfowler commented 6 years ago

Yes. I want to do this. Add a sample integration config in both cases, and use a partial method in order to do the actual config (a public method would redirect into it).

That means that the sample class may be overwritten at any time and there is nothing that the user wouldn't want in the sample one.

The sample class can contain comments which show a number of optional configuration scenarios.

craigfowler commented 6 years ago

I'm fast changing my mind on this one. The more research I do into NuGet, the less I think that this is appropriate.

The documentation here indicates what my available options are for the inclusion of content files.

https://docs.microsoft.com/en-us/nuget/reference/nuspec

Of note is the section about the ContentFiles XML element and what's available.

There's no option to specify things like "only copy if it doesn't already exist" or "do not replace existing" etc.

This means that if a consumer included their own one of these sections and then expanded it, every time they upgraded or reinstalled the package, I'd end up overwriting.

Instead I'm now leaning more towards just using a README file which includes some instructions and directs the reader towards the online docs.