{"id":27639469,"url":"https://github.com/executeautomation/executeautomation.reqnroll.dynamics","last_synced_at":"2025-04-23T22:16:54.050Z","repository":{"id":272657823,"uuid":"917355565","full_name":"executeautomation/ExecuteAutomation.Reqnroll.Dynamics","owner":"executeautomation","description":"Package to handle Reqnroll tables with Dynamic types","archived":false,"fork":false,"pushed_at":"2025-04-16T21:57:40.000Z","size":167,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-23T22:16:49.164Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/executeautomation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-15T20:33:51.000Z","updated_at":"2025-04-16T21:52:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"d2e135d3-8a12-4a08-8098-2060e418293f","html_url":"https://github.com/executeautomation/ExecuteAutomation.Reqnroll.Dynamics","commit_stats":null,"previous_names":["executeautomation/executeautomation.reqnroll.dynamics"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/executeautomation%2FExecuteAutomation.Reqnroll.Dynamics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/executeautomation%2FExecuteAutomation.Reqnroll.Dynamics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/executeautomation%2FExecuteAutomation.Reqnroll.Dynamics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/executeautomation%2FExecuteAutomation.Reqnroll.Dynamics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/executeautomation","download_url":"https://codeload.github.com/executeautomation/ExecuteAutomation.Reqnroll.Dynamics/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250522296,"owners_count":21444512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-23T22:16:53.517Z","updated_at":"2025-04-23T22:16:54.042Z","avatar_url":"https://github.com/executeautomation.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExecuteAutomation.Reqnroll.Dynamics\n\nA powerful library that enhances [Reqnroll](https://reqnroll.net/) (formerly SpecFlow) with dynamic data handling capabilities, simplifying how data is created and manipulated in Gherkin feature files.\n\n---\n\n## Features\n\n### Core Dynamic Table Capabilities\n\n- **Dynamic Instance Creation**: Convert tables to dynamic objects\n  ```csharp\n  dynamic data = table.CreateDynamicInstance();\n  ```\n\n- **Dynamic Set Creation**: Convert tables to collections of dynamic objects\n  ```csharp\n  var items = table.CreateDynamicSet();\n  ```\n\n- **Dynamic Data Comparison**: Compare tables with dynamic objects or collections\n  ```csharp\n  table.CompareToDynamicInstance(instance);\n  table.CompareToDynamicSet(set);\n  ```\n\n- **Step Argument Transformations**: Built-in transformations for automated conversion\n  ```csharp\n  // In step definitions, tables are automatically transformed\n  public void GivenTheFollowingUsers(IEnumerable\u003cobject\u003e users) { ... }\n  public void GivenAUser(dynamic user) { ... }\n  ```\n\n### Enhanced Table Manipulation\n\n- **Horizontal/Vertical Table Transformation**: Transform between table formats\n  ```csharp\n  var horizontalTable = CreateHorizontalTable(verticalTable);\n  ```\n\n- **Table Filtering**: Filter rows based on specific criteria\n  ```csharp\n  var filteredTable = table.FilterRows(row =\u003e row[\"Status\"] == \"Active\");\n  ```\n\n- **Column Projection**: Create a new table with only specified columns\n  ```csharp\n  var projectedTable = table.SelectColumns(\"FirstName\", \"LastName\");\n  ```\n\n- **Nested Object Creation**: Create hierarchical objects from tables with JSON data\n  ```csharp\n  var nestedObject = table.CreateNestedDynamicInstance();\n  ```\n\n### Async Support\n\n- **Asynchronous Operations**: Use async versions of all core methods\n  ```csharp\n  var dynamicObject = await table.CreateDynamicInstanceAsync();\n  var dynamicSet = await table.CreateDynamicSetAsync();\n  await table.CompareToDynamicInstanceAsync(instance);\n  ```\n\n### AutoFixture Integration\n\n- **Random Data Generation**: Create tables with auto-generated test data\n  ```gherkin\n  Given users with the following details:\n    | Username    | Email      | DateOfBirth | PhoneNumber |\n    | auto.string | auto.email | auto.date   | auto.phone  |\n    | _           | _          | _           | _           |\n  ```\n\n- **Type Inference**: Automatic type detection from column names\n  ```gherkin\n  # The underscore (_) will infer appropriate data types based on column names\n  | Username | Email | DateOfBirth | PhoneNumber |\n  | _        | _     | _           | _           |\n  ```\n\n- **Supported Data Types**:\n  - `auto.string` - Random string values\n  - `auto.int` - Random integer values\n  - `auto.decimal`, `auto.double` - Random numeric values\n  - `auto.date`, `auto.datetime` - Random date/time values\n  - `auto.bool` - Random boolean values\n  - `auto.guid` - Random GUIDs\n  - `auto.email` - Random email addresses\n  - `auto.phone` - Random phone numbers\n  - `auto.url` - Random URLs\n  - `auto.name`, `auto.firstname`, `auto.lastname` - Random name values\n  - `auto.address` - Random street addresses\n  - `auto.city` - Random city names\n  - `auto.zipcode` - Random ZIP/postal codes\n\n- **Custom Entity Generation**: Register your own domain entity generators\n  ```csharp\n  // In test setup\n  AutoFixtureTableExtensions.RegisterEntityType\u003cUser\u003e(\"user\");\n  AutoFixtureTableExtensions.RegisterEntityType\u003cProduct\u003e(\"product\");\n  \n  // Custom generator with specific logic\n  AutoFixtureTableExtensions.RegisterEntityGenerator\u003cPremiumUser\u003e(\"premium-user\", \n    () =\u003e new PremiumUser { Level = \"Gold\", ... });\n  ```\n\n- **Batch Entity Creation**: Generate multiple entities of a registered type\n  ```csharp\n  // Create 5 User entities\n  var users = AutoFixtureTableExtensions.CreateEntities(\"User\", 5);\n  ```\n\n- **Async AutoFixture Support**: Async versions of all AutoFixture methods\n  ```csharp\n  // Async versions of methods\n  dynamic instance = await table.CreateDynamicInstanceWithAutoFixtureAsync();\n  var items = await table.CreateDynamicSetWithAutoFixtureAsync();\n  \n  // Batch entity creation async\n  var users = await AutoFixtureTableExtensions.CreateEntitiesAsync(\"User\", 5);\n  ```\n\n- **Usage in Step Definitions**:\n  ```csharp\n  [Given(@\"users with the following details:\")]\n  public void GivenUsersWithTheFollowingDetails(Table table)\n  {\n      var users = table.CreateDynamicSetWithAutoFixture();\n      // Process users...\n  }\n  ```\n\n### Using Transformations in Step Definitions\n\nDue to the dynamic nature of this library, automatic step argument transformations are not supported. Instead, you should explicitly call the transformation methods in your step definitions:\n\n```csharp\n// Explicitly transform the table to a dynamic object\n[Given(@\"I have a user with following details\")]\npublic void GivenIHaveAUserWithFollowingDetails(Table table)\n{\n    dynamic user = table.CreateDynamicInstance();\n    string name = user.Name;\n    int age = user.Age;\n}\n\n// For collections of dynamic objects\n[Given(@\"I have the following users\")]\npublic void GivenIHaveTheFollowingUsers(Table table)\n{\n    var users = table.CreateDynamicSet();\n    foreach (var user in users)\n    {\n        // Process each user\n    }\n}\n\n// For nested objects\n[Given(@\"I have the following entities\")]\npublic void GivenIHaveTheFollowingEntities(Table table)\n{\n    dynamic entities = table.CreateNestedDynamicInstance();\n    string userName = entities.User.Name;\n    string addressStreet = entities.Address.Street;\n}\n\n// For async operations\n[Given(@\"I have async data\")]\npublic async Task GivenIHaveAsyncData(Table table)\n{\n    dynamic data = await table.CreateDynamicInstanceAsync();\n    // Use the data\n}\n```\n\n---\n\n## Installation\n\nTo install **ExecuteAutomation.Reqnroll.Dynamics**, add the NuGet package to your project using one of the following methods:\n\n### Package Manager\n```bash\nInstall-Package ExecuteAutomation.Reqnroll.Dynamics\n```\n\n### .NET CLI\n```bash\ndotnet add package ExecuteAutomation.Reqnroll.Dynamics\n```\n\n### PackageReference\nAdd the following line to your `.csproj` file:\n```xml\n\u003cPackageReference Include=\"ExecuteAutomation.Reqnroll.Dynamics\" Version=\"1.1.2\" /\u003e\n```\n\n---\n\n## Getting Started\n\n### Basic Usage\n\n1. Import the namespace in your step definition files:\n```csharp\nusing ExecuteAutomation.Reqnroll.Dynamics;\n```\n\n2. Use the extension methods on Reqnroll `Table` objects:\n```csharp\n[Given(@\"the following products:\")]\npublic void GivenTheFollowingProducts(Table table)\n{\n    var products = table.CreateDynamicSet();\n    // Use products in your test...\n}\n```\n\n### Using Random Data Generation\n\n1. Create feature files with auto-generated data:\n```gherkin\nFeature: User Registration\n\nScenario: Register new users\n  Given users with the following details:\n    | Username    | Email      | DateOfBirth | PhoneNumber |\n    | auto.string | auto.email | auto.date   | auto.phone  |\n    | _           | _          | _           | _           |\n  When I register these users\n  Then all registrations should be successful\n```\n\n2. Register custom entity generators in your test setup:\n```csharp\n[BeforeTestRun]\npublic static void SetupAutoFixture()\n{\n    AutoFixtureTableExtensions.RegisterEntityType\u003cUser\u003e(\"user\");\n    AutoFixtureTableExtensions.RegisterEntityType\u003cProduct\u003e(\"product\");\n}\n```\n\n---\n\n## Advanced Features\n\n### Dynamic Object Creation\n\n#### Creating from a Horizontal Table\n\n```csharp\n// Given a table:\n// | Name  | Age | IsActive |\n// | John  | 30  | true     |\n\nvar person = table.CreateDynamicInstance();\n// person.Name == \"John\"\n// person.Age == 30 (int)\n// person.IsActive == true (bool)\n```\n\n#### Creating from a Vertical Table\n\n```csharp\n// Given a table:\n// | Field    | Value  |\n// | Name     | John   |\n// | Age      | 30     |\n// | IsActive | true   |\n\nvar person = table.CreateDynamicInstance();\n// person.Name == \"John\"\n// person.Age == 30 (int)\n// person.IsActive == true (bool)\n```\n\n### Creating a Set of Dynamic Objects\n\n```csharp\n// Given a table:\n// | Name  | Age | IsActive |\n// | John  | 30  | true     |\n// | Jane  | 25  | false    |\n// | Bob   | 45  | true     |\n\nvar people = table.CreateDynamicSet();\n// people[0].Name == \"John\", people[0].Age == 30, people[0].IsActive == true\n// people[1].Name == \"Jane\", people[1].Age == 25, people[1].IsActive == false\n// people[2].Name == \"Bob\", people[2].Age == 45, people[2].IsActive == true\n```\n\n### Table Transformation Utilities\n\n#### Filtering Table Rows\n\n```csharp\n// Given a table:\n// | Name  | Age | IsActive |\n// | John  | 30  | true     |\n// | Jane  | 25  | false    |\n// | Bob   | 45  | true     |\n\nvar filteredTable = table.FilterRows(row =\u003e row[\"IsActive\"] == \"true\");\n// filteredTable will have 2 rows: John and Bob\n```\n\n#### Projecting Table Columns\n\n```csharp\n// Given a table:\n// | Name  | Age | Email             | Phone      |\n// | John  | 30  | john@example.com  | 1234567890 |\n// | Jane  | 25  | jane@example.com  | 0987654321 |\n\nvar projectedTable = table.SelectColumns(\"Name\", \"Email\");\n// projectedTable will have columns: Name, Email\n```\n\n#### Creating Nested Objects\n\n```csharp\n// Given a table:\n// | Entity   | Properties                                     |\n// | User     | {\"Name\": \"John\", \"Age\": 30, \"IsActive\": true}  |\n// | Address  | {\"Street\": \"Main St\", \"City\": \"New York\"}      |\n\nvar entity = table.CreateNestedDynamicInstance();\n// entity.User.Name == \"John\"\n// entity.User.Age == 30\n// entity.User.IsActive == true\n// entity.Address.Street == \"Main St\"\n// entity.Address.City == \"New York\"\n```\n\n### Async Support\n\nUse asynchronous methods for better integration with asynchronous test frameworks:\n\n```csharp\n// Async dynamic instance creation\nvar dynamicObject = await table.CreateDynamicInstanceAsync();\n\n// Async dynamic set creation\nvar dynamicSet = await table.CreateDynamicSetAsync();\n\n// Async comparison operations\nawait table.CompareToDynamicInstanceAsync(instance);\nawait table.CompareToDynamicSetAsync(set);\n\n// Async table transformations\nvar filteredTable = await table.FilterRowsAsync(row =\u003e row[\"Status\"] == \"Active\");\nvar projectedTable = await table.SelectColumnsAsync(\"FirstName\", \"LastName\");\nvar nestedObject = await table.CreateNestedDynamicInstanceAsync();\n```\n\n### Type Conversion\n\nThe library automatically handles type conversion for common types:\n- Strings\n- Integers\n- Doubles/Decimals\n- Booleans\n- DateTime values\n\n---\n\n## Contributing\n\nContributions are welcome! Fork this repository, create a branch, and submit a pull request with your changes.\n\n---\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n---\n\n## Acknowledgments\n\nThis project is a fork of the popular [Specflow.Assist.Dynamics](https://github.com/marcusoftnet/SpecFlow.Assist.Dynamic) package, with enhancements tailored for the **Reqnroll** community.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexecuteautomation%2Fexecuteautomation.reqnroll.dynamics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexecuteautomation%2Fexecuteautomation.reqnroll.dynamics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexecuteautomation%2Fexecuteautomation.reqnroll.dynamics/lists"}