Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

table value is converting to date time by default #26

Open
Suban5 opened this issue Sep 8, 2020 · 1 comment
Open

table value is converting to date time by default #26

Suban5 opened this issue Sep 8, 2020 · 1 comment

Comments

@Suban5
Copy link

Suban5 commented Sep 8, 2020

I have a table like following in my features files:

Then I should see 'View' option on following rows
| version    | temp           | promote          |
| 17.0       |                      | 2020-08-14      |
| 17.1       | 2020-08-18  |                          |
| 17.2       |                      | 2020-09-14      |
| 17.2       | 2020-09-1 5 |                          |
| 17.3       |                      | 2020-09-18      |
| 17.4       | 2020-09-28  |                          |

And In Step definition I am using CreateDynamicSet from Specflow.Assist.Dynamic(1.4.2) to get the table value:

[Then(@"I should see '(.*)' option on following rows")]
    public void ThenIShouldSeeOptionOnFollowingRows(string actionType, Table table)
    {
          
         IEnumerable<dynamic> tableData = table.CreateDynamicSet();
        foreach(var row in tableData)
        {
           

            string wcspVersion = row.version.ToString();
            string temp = row.temp.ToString();
            string promote = row.promote.ToString();

            Console.WriteLine("Test2");
            Console.WriteLine($"wcspVersion = {wcspVersion}");
            Console.WriteLine($"temp ={temp}");
            Console.WriteLine($" promote ={promote}");

            
        }
    }

While printing the value having Date like 2020-08-14 it is converting to date like 18-Aug-20 12:00:00 AM.
And While converting 17.0 to string I am getting only 17

I don't want this kind conversion. I need to get the exact value that is in the feature files. How can I get the exact value from the feature file as string?

I am getting expected result while using CreateSet

@kazantsev033
Copy link

table.CreateDynamicSet(doTypeConversion: false) should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants