{"action":"created","issue":{"url":"https://api.github.com/repos/techtalk/SpecFlow/issues/673","repository_url":"https://api.github.com/repos/techtalk/SpecFlow","labels_url":"https://api.github.com/repos/techtalk/SpecFlow/issues/673/labels{/name}","comments_url":"https://api.github.com/repos/techtalk/SpecFlow/issues/673/comments","events_url":"https://api.github.com/repos/techtalk/SpecFlow/issues/673/events","html_url":"https://github.com/techtalk/SpecFlow/issues/673","id":167175655,"number":673,"title":"Support for Step Argument Transforms on table cells","user":{"login":"jkonecki","id":1775247,"avatar_url":"https://avatars.githubusercontent.com/u/1775247?v=3","gravatar_id":"","url":"https://api.github.com/users/jkonecki","html_url":"https://github.com/jkonecki","followers_url":"https://api.github.com/users/jkonecki/followers","following_url":"https://api.github.com/users/jkonecki/following{/other_user}","gists_url":"https://api.github.com/users/jkonecki/gists{/gist_id}","starred_url":"https://api.github.com/users/jkonecki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkonecki/subscriptions","organizations_url":"https://api.github.com/users/jkonecki/orgs","repos_url":"https://api.github.com/users/jkonecki/repos","events_url":"https://api.github.com/users/jkonecki/events{/privacy}","received_events_url":"https://api.github.com/users/jkonecki/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-23T08:59:48Z","updated_at":"2016-07-25T13:41:50Z","closed_at":null,"body":"Step Argument Transforms is a brilliant mechanism for defining custom transformations of values to non-standard types. Transformations can be reused in different steps but they doesn't work on values in table cells.\r\n\r\nExample from [Google Group post](https://groups.google.com/forum/#!msg/specflow/8fS0l2gRbS4/PTCsslqKOwMJ)\r\n\r\n``` C#\r\nGiven I have the following fert events:\r\n\t| Date        | Name | Makeup           | Paddocks | Application Rate |\r\n\t| 10 days ago | Urea | 1, 2, 3, 4, 5, 6 | busy     | 100              |\r\n\t| 10 days ago | DAP  | 2, 3, 4, 5, 6, 7 | busy     | 1000             |\r\nAnd I can view paddock history\r\nAnd I am signed in\r\nWhen I a view the paddock history for paddock 'busy'\r\nThen I see the following paddock history events:\r\n\t| Date        | Particulars line 1    | Amount       |\r\n\t| 10 days ago | Urea                  | 100 kg/ha    |\r\n\t| 10 days ago | DAP                   | 1000 kg/ha   |\r\n\r\nAnd the step looks like this:\r\n\r\n[Then(@\"I see the following paddock history events:\")]\r\npublic void ThenISeeTheFollowingPaddockHistoryEvents(Table table)\r\n{\r\n\t// Convert table to a strongly-typed row set\r\n\tvar expectedEventRows = table.CreateSet<PaddockHistoryTableRow>();\r\n \r\n\t// Process the relative date strings into real dates \r\n\t// (this is where Step Argument Transforms on the table cells would be awesome)\r\n\tvar expectedEventsWithActualDates = expectedEventRows.Select(r => new\r\n\t{\r\n\t\tDate = r.Date.ParseRelativeDayDescription(), \r\n\t\tParticularsLine1 = r.ParticularsLine1, \r\n\t\tAmount = r.Amount\r\n\t}).ToList();\r\n \r\n\t// Get my actuals\r\n\tvar actualEvents = _paddockHistoryWizard.EventsPane.PaddockHistoryEvents;\r\n \r\n\t// Manually compare actuals with expecteds\r\n\tAssert.AreEqual(expectedEventsWithActualDates.Count, actualEvents.Count);\r\n\tforeach (var expected in expectedEventsWithActualDates)\r\n\t{\r\n\t\tAssert.IsTrue(actualEvents.Any(actual => \r\n\t\t\tactual.Amount == expected.Amount\r\n\t\t\t&& actual.Date == expected.Date \r\n\t\t\t&& actual.ParticularsLine1 == expected.ParticularsLine1));\r\n\t}\r\n}\r\n```\r\n\r\nIn the above example one has to manually convert the `10 days ago` into `DateTime` object even if the appropriate Step Argument Transformation has been defined."},"comment":{"url":"https://api.github.com/repos/techtalk/SpecFlow/issues/comments/234956097","html_url":"https://github.com/techtalk/SpecFlow/issues/673#issuecomment-234956097","issue_url":"https://api.github.com/repos/techtalk/SpecFlow/issues/673","id":234956097,"user":{"login":"darrencauthon","id":148768,"avatar_url":"https://avatars.githubusercontent.com/u/148768?v=3","gravatar_id":"","url":"https://api.github.com/users/darrencauthon","html_url":"https://github.com/darrencauthon","followers_url":"https://api.github.com/users/darrencauthon/followers","following_url":"https://api.github.com/users/darrencauthon/following{/other_user}","gists_url":"https://api.github.com/users/darrencauthon/gists{/gist_id}","starred_url":"https://api.github.com/users/darrencauthon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrencauthon/subscriptions","organizations_url":"https://api.github.com/users/darrencauthon/orgs","repos_url":"https://api.github.com/users/darrencauthon/repos","events_url":"https://api.github.com/users/darrencauthon/events{/privacy}","received_events_url":"https://api.github.com/users/darrencauthon/received_events","type":"User","site_admin":false},"created_at":"2016-07-25T13:41:50Z","updated_at":"2016-07-25T13:41:50Z","body":"This has come up multiple times, and I've put a lot of work into it.  My last comment was here:  https://github.com/techtalk/SpecFlow/pull/536#issuecomment-216872191\r\n\r\nIn a nutshell, the table helpers are all static, and the step transformations are woven into the state of the test run.  I took it pretty far, I think.  I had it to the point where I just needed to get int the proper IoC container to get the state I needed to resolve the step argument transformation.  This is from my memory, but I think I even had it wired it up where I had a step transformation working within the table assist, but... I had it wired to the wrong IoC container.  \r\n\r\nAnyway, perhaps this could use a second set of eyes.  @jkonecki, in the meantime, you can write an extension to the table assist [like this](https://github.com/techtalk/SpecFlow/blob/396e0e40ca06e68c01a4ca46fa0dfc9fbbb5a8c3/TechTalk.SpecFlow/Assist/ValueRetrievers/DateTimeValueRetriever.cs) and plug it into the system [like this](https://github.com/techtalk/SpecFlow/blob/396e0e40ca06e68c01a4ca46fa0dfc9fbbb5a8c3/Tests/TechTalk.SpecFlow.RuntimeTests/AssistTests/ValueRetrieverTests/DateTimeValueRetrieverTests.cs#L14).  If you could include this logic without adding a dependency, you could even add it as a pull request."}}
{"actor":{"display_login":"darrencauthon"}}