NSpec icon indicating copy to clipboard operation
NSpec copied to clipboard

Persisting underscore in Assertions

Open warwickfoster opened this issue 8 years ago • 2 comments

context[$"processing file - \"{file.Name}\""] = () =>{}

I would like to persist the underscores in the filename so would like to escape out the underscore as follows:

context[$"processing file - \"{file.Name.Replace("_","\\")}\""] = () => {}

Any options?

warwickfoster avatar Jun 29 '17 03:06 warwickfoster

Hi there. Do you mean something like this?

public class describe_underscore_in_context : nspec
{
    void Given_nested_context_name_has_underscores()
    {
        context["This_nested_context will lose underscores"] = () =>
        {
            it["Should pass"] = () => true.ShouldBeTrue();
        };

        context["This\\_nested\\_context will keep underscores"] = () =>
        {
            it["Should pass"] = () => true.ShouldBeTrue();
        };
    }
}

BrainCrumbz avatar Jun 29 '17 17:06 BrainCrumbz

There is a Conventions concept have baked in NSpec

amirrajan avatar Jun 29 '17 19:06 amirrajan