Feature: add fake data module#129
Conversation
Greptile SummaryThis PR introduces a new Key findings:
Confidence Score: 3/5
|
| Filename | Overview |
|---|---|
| src/modules/fakedata/Elsa.FakeData/Activities/GenerateFakeDataActivity.cs | Base activity for fake data generation; missing validation for negative Count values which causes an unhandled exception from Bogus. |
| src/modules/fakedata/Elsa.FakeData/Activities/GenerateFakePersons.cs | Generates fake person records; DateTime.Now reference in DateOfBirth rule breaks determinism even when a seed is provided, and an unused lambda parameter may trigger a compiler warning. |
| src/modules/fakedata/Elsa.FakeData/Activities/GenerateFakeUsers.cs | Generates fake user records; two lambdas declare an unused second parameter u, which may produce compiler warnings. |
| src/modules/fakedata/Elsa.FakeData/Activities/GenerateFakeOrders.cs | Generates fake order records with correctly derived Tax and Total fields; clean implementation with no issues found. |
| src/modules/fakedata/Elsa.FakeData/Activities/GenerateFakeProducts.cs | Generates fake product records; straightforward and correct implementation. |
| src/modules/fakedata/Elsa.FakeData/Elsa.FakeData.csproj | Project file includes an unnecessary Microsoft.Extensions.Http reference that is not used anywhere in the module. |
| src/modules/fakedata/Elsa.FakeData/Features/FakeDataFeature.cs | Minimal feature registration that scans the assembly for activity types; follows established patterns correctly. |
| test/modules/fakedata/Elsa.FakeData.UnitTests/Activities/GenerateFakePersonsTests.cs | Good test coverage, but the determinism test does not assert DateOfBirth, masking the DateTime.Now non-determinism issue in the activity. |
| Elsa.Extensions.sln | Adds two solution folders both named "fakedata" (for src and test), which may cause confusion in solution explorer tooling, though functionally valid when properly nested. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Workflow Engine] -->|calls| B[GenerateFakeDataActivity<T>]
B -->|reads| C[Count Input]
B -->|reads| D[Locale Input]
B -->|reads| E[Seed Input]
B -->|creates| F[Faker<T> via CreateFaker]
F -->|seed != null| G[UseSeed]
F -->|seed == null| H[Random seed]
G --> I[faker.Generate count]
H --> I
I -->|sets| J[Result Output T array]
B --> K1[GenerateFakeUsers]
B --> K2[GenerateFakePersons]
B --> K3[GenerateFakeProducts]
B --> K4[GenerateFakeOrders]
K1 -->|produces| L1[FakeUser records]
K2 -->|produces| L2[FakePerson records]
K3 -->|produces| L3[FakeProduct records]
K4 -->|produces| L4[FakeOrder records]
M[UseFakeData extension] -->|registers| N[FakeDataFeature]
N -->|AddActivitiesFrom| K1
N -->|AddActivitiesFrom| K2
N -->|AddActivitiesFrom| K3
N -->|AddActivitiesFrom| K4
Last reviewed commit: 6d57981
Additional Comments (1)
Two separate solution folders are both named |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This pull request introduces a new "Fake Data" module to the solution, enabling the generation of realistic test data for workflows using the Bogus library. The module provides configurable activities for generating collections of fake users, persons, products, and orders, along with supporting models, features, and extension methods for easy integration. Solution and project files are updated to include the module and its unit tests.
Solution and Project Structure Updates
Elsa.FakeDataandElsa.FakeData.UnitTestsprojects, their folder structure, build configurations, and project dependencies.Fake Data Module Implementation
Elsa.FakeDataproject with activities to generate fake data for users, persons, products, and orders, leveraging the Bogus library for data generation.GenerateFakeUsers,GenerateFakePersons,GenerateFakeProducts, andGenerateFakeOrders, each producing collections of strongly-typed fake records.FakeUser,FakePerson,FakeProduct, andFakeOrderto represent generated data records.Tests:
Elsa.FakeData.UnitTestsfor all added activities.Example Usage: