Closed deyanp closed 4 years ago
Hi Deyan - the tags can be searched by their name:
scenario.TagList.AllTags |> Seq.tryPick(fun t -> t.Name = "@mocked)
I'm marking tags as visited, however I'm not sure about that now (as this wouldn't visit that tag as its getting it from the array....I might ad a way to exclude them from the report a bit easier)
Yes, yours is the "untyped" approach with string comparison, above I have used the "strongly-typed" approach with scenario.Tags.mocked ... but somehow the strongly-typed approach is strange because if @mocked is not there it will not even compile ;)
yes that's right....there is a class called TagContainer on the scenario that will always have an array of the untyped tags. Typed tags are added as properties to the container using their name just like scenarios. If you remove that tag from your scenario then it will "disappear" from the container (the magic of type providers lol).
I'm still not 100% sure about that functionality cos as you know tags are a bit different as they're more about implementation than behaviour and i think that they would be used more like you are i.e. do they exist based on their name
I've fixed the fact that Features without tags were missing the underlying array and added a HasTag method which makes it easier to check for the existance of tags
let shouldMock = scenario.HasTag("@mocked")
....hope this helps
I need to get a boolean flag true/false representing the present/absence of a scenario tag.
Is this the best way to do it, as it seems a bit redundant, and in case I remove the tag the line will not compile anyway:
(the tag is @mocked and is set at the scenario level)