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

Mock Data generate Option added in Value Expression #3809

Merged
merged 6 commits into from
Jul 8, 2024

Conversation

prashelke
Copy link
Contributor

@prashelke prashelke commented Jul 5, 2024

Thank you for your contribution.
Before submitting this PR, please make sure:

  • PR description and commit message should describe the changes done in this PR
  • Verify the PR is pointing to correct branch i.e. Release or Beta branch if the code fix is for specific release , else point it to master
  • Latest Code from master or specific release branch is merged to your branch
  • No unwanted\commented\junk code is included
  • No new warning upon build solution
  • Code Summary\Comments are added to my code which explains what my code is doing
  • Existing unit test cases are passed
  • New Unit tests are added for your development
  • Sanity Tests are successfully executed for New and Existing Functionality
  • Verify that changes are compatible with all relevant browsers and platforms.
  • After creating pull request there should not be any conflicts
  • Resolve all Codacy comments
  • Builds and checks are passed before PR is sent for review
  • Resolve code review comments
  • Update the Help Library document to match any feature changes

Summary by CodeRabbit

  • New Features

    • Added the ability to generate mock data within expressions using the Bogus library.
    • New icons and categories for easier identification and organization of items.
  • Bug Fixes

    • Removed outdated and commented-out code for cleaner and more efficient execution.
  • Tests

    • Introduced new test cases for validating various types of mock data expressions, ensuring reliability and correctness.

Copy link
Contributor

coderabbitai bot commented Jul 5, 2024

Walkthrough

The recent updates introduce new capabilities for handling mock data generation using the Bogus library. Changes include new enum values for eImageType, methods to process mock data expressions, and various UI updates to utilize these enhancements. A notable update is the addition of FontAwesome icons to the SetImage() method for different image types.

Changes

Files/Groups Change Summary
Ginger/.../ImageMakerControl.xaml.cs Added cases to SetImage() method to handle new eImageTypes and set FontAwesome icons.
Ginger/.../ValueExpressionEditorPage.xaml.cs Added new cases in GetCategoryImageType, and removed commented-out code in AddEnvParams.
GingerCoreCommon/EnumsLib/eImageType.cs Added new enum values: AddressCard, IdCard, IdBadge, Phone, and MoneyCheckDollar to the eImageType.
GingerCoreNET/GingerCoreNET.csproj Added Bogus package reference (version 35.5.1).
GingerCoreNET/RosLynLib/CodeProcessor.cs Added methods for processing expressions with mock data generation using the Bogus library.
GingerCoreNET/ValueExpressionLib/ValueExpression.cs Added a private method EvaluateBogusDataGenrateFunctions(), updated Calculate() method, and added a check for "{MockDataExp" in ContainsFormula().
GingerCoreNETUnitTest/RosLynTestLib/GlobalsTest.cs Added new test methods for generating and validating various types of mock data expressions using CodeProcessor.GetBogusDataGenerateresult.

Poem

Mock data flows, like a dream,
In the land of Bogus, fields gleam.
Enums fresh, icons new,
Ginger’s core now helps you queue.
Code so bright, tests in flight,
A rabbit's touch feels just right. 🐇🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e5c04af and 693da16.

Files ignored due to path filters (1)
  • Ginger/GingerCoreNET/RosLynLib/ValueExpressionRefrences.json is excluded by !**/*.json
Files selected for processing (7)
  • Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs (1 hunks)
  • Ginger/Ginger/ValueExpression/ValueExpressionEditorPage.xaml.cs (4 hunks)
  • Ginger/GingerCoreCommon/EnumsLib/eImageType.cs (1 hunks)
  • Ginger/GingerCoreNET/GingerCoreNET.csproj (1 hunks)
  • Ginger/GingerCoreNET/RosLynLib/CodeProcessor.cs (2 hunks)
  • Ginger/GingerCoreNET/ValueExpressionLib/ValueExpression.cs (3 hunks)
  • Ginger/GingerCoreNETUnitTest/RosLynTestLib/GlobalsTest.cs (2 hunks)
Files skipped from review due to trivial changes (1)
  • Ginger/GingerCoreNET/GingerCoreNET.csproj
Additional comments not posted (37)
Ginger/GingerCoreCommon/EnumsLib/eImageType.cs (1)

328-332: Enum values added correctly.

The new enum values AddressCard, IdCard, IdBadge, Phone, and MoneyCheckDollar are correctly added and follow the existing naming conventions.

Ginger/GingerCoreNETUnitTest/RosLynTestLib/GlobalsTest.cs (32)

68-75: Test method added correctly.

The test method TestBogusData_AddressCountry_IsNotnullAndEmpty correctly validates the expression for generating a country address using the Bogus library.


77-84: Test method added correctly.

The test method TestBogusData_AddressfullAddress_IsNotnullAndEmpty correctly validates the expression for generating a full address using the Bogus library.


87-94: Test method added correctly.

The test method PastDate_FetchPastDateOnly_IsNotnullAndEmpty correctly validates the expression for generating a past date using the Bogus library.


96-103: Test method added correctly.

The test method PastDate_FetchFutureDateOnly_IsNotnullAndEmpty correctly validates the expression for generating a future date using the Bogus library.


105-112: Test method added correctly.

The test method PastDate_FetchBetweenDateOnly_IsNotnullAndEmpty correctly validates the expression for generating a date between two dates using the Bogus library.


114-121: Test method added correctly.

The test method PastDate_FetchPastDate_IsNotnullAndEmpty correctly validates the expression for generating a past date using the Bogus library.


123-130: Test method added correctly.

The test method PastDate_FetchFutureDate_IsNotnullAndEmpty correctly validates the expression for generating a future date using the Bogus library.


132-141: Test method added correctly.

The test method PastDate_FetchBetweenDate_IsNotnullAndEmpty correctly validates the expression for generating a date between two dates using the Bogus library.


143-150: Test method added correctly.

The test method PastDate_FetchMonth_IsNotnullAndEmpty correctly validates the expression for generating a month using the Bogus library.


152-159: Test method added correctly.

The test method PastDate_FetchWeekday_IsNotnullAndEmpty correctly validates the expression for generating a weekday using the Bogus library.


162-169: Test method added correctly.

The test method TestBogusData_FinanceFinanceAccountNumber_IsNotnullAndEmpty correctly validates the expression for generating a finance account number using the Bogus library.


171-178: Test method added correctly.

The test method TestBogusData_FinanceTransactionType_IsNotnullAndEmpty correctly validates the expression for generating a finance transaction type using the Bogus library.


180-187: Test method added correctly.

The test method TestBogusData_FinanceCreditCardNumber_IsNotnullAndEmpty correctly validates the expression for generating a finance credit card number using the Bogus library.


189-196: Test method added correctly.

The test method TestBogusData_FinanceCreditCardCvv_IsNotnullAndEmpty correctly validates the expression for generating a finance credit card CVV using the Bogus library.


198-205: Test method added correctly.

The test method TestBogusData_FinanceBIC_IsNotnullAndEmpty correctly validates the expression for generating a finance BIC using the Bogus library.


207-214: Test method added correctly.

The test method TestBogusData_FinanceIBAN_IsNotnullAndEmpty correctly validates the expression for generating a finance IBAN using the Bogus library.


216-223: Test method added correctly.

The test method TestBogusData_FinanceCurrencyCode_IsNotnullAndEmpty correctly validates the expression for generating a finance currency code using the Bogus library.


225-231: Test method added correctly.

The test method TestBogusData_FinanceCurrencySymbol_IsNotnullAndEmpty correctly validates the expression for generating a finance currency symbol using the Bogus library.


234-241: Test method added correctly.

The test method TestBogusData_InternetEmail_IsNotnullAndEmpty correctly validates the expression for generating an internet email using the Bogus library.


243-249: Test method added correctly.

The test method TestBogusData_InternetUserName_IsNotnullAndEmpty correctly validates the expression for generating an internet username using the Bogus library.


252-258: Test method added correctly.

The test method TestBogusData_InternetPassword_IsNotnullAndEmpty correctly validates the expression for generating an internet password using the Bogus library.


261-267: Test method added correctly.

The test method TestBogusData_NameFirstName_IsNotnullAndEmpty correctly validates the expression for generating a first name using the Bogus library.


270-276: Test method added correctly.

The test method TestBogusData_NameLastName_IsNotnullAndEmpty correctly validates the expression for generating a last name using the Bogus library.


279-285: Test method added correctly.

The test method TestBogusData_NameFullName_IsNotnullAndEmpty correctly validates the expression for generating a full name using the Bogus library.


288-294: Test method added correctly.

The test method TestBogusData_PhoneNumbersPhoneNumbers_IsNotnullAndEmpty correctly validates the expression for generating a phone number using the Bogus library.


297-303: Test method added correctly.

The test method TestBogusData_RandomizerNumber_IsNotnullAndEmpty correctly validates the expression for generating a random number using the Bogus library.


306-312: Test method added correctly.

The test method TestBogusData_RandomizerDigits_IsNotnullAndEmpty correctly validates the expression for generating random digits using the Bogus library.


315-321: Test method added correctly.

The test method TestBogusData_RandomizerDecimal_IsNotnullAndEmpty correctly validates the expression for generating a random decimal using the Bogus library.


324-330: Test method added correctly.

The test method TestBogusData_RandomizerString_IsNotnullAndEmpty correctly validates the expression for generating a random string using the Bogus library.


333-339: Test method added correctly.

The test method TestBogusData_RandomizerAlphaNumeric_IsNotnullAndEmpty correctly validates the expression for generating an alphanumeric string using the Bogus library.


342-349: Test method added correctly.

The test method TestBogusData_complexExpression correctly validates the expression for generating a complex expression using the Bogus library.


351-358: Test method added correctly.

The test method TestBogusData_WrongExpression correctly validates the handling of an incorrect expression using the Bogus library.

Ginger/Ginger/ValueExpression/ValueExpressionEditorPage.xaml.cs (1)

421-444: Method updated correctly to handle new categories.

The method GetCategoryImageType has been correctly updated to handle new categories: "Mock Data", "Address", "Date", "Finance", "Internet", "

Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs (1)

999-1013: LGTM! Verify the usage of the new enum values.

The new cases for eImageType are consistent with the existing ones and follow the same pattern of setting FontAwesome icons. Ensure that the new enum values are used correctly throughout the codebase.

Verification successful

The new enum values are used correctly throughout the codebase.

The occurrences of the new enum values in the files Ginger/Ginger/ValueExpression/ValueExpressionEditorPage.xaml.cs and Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs indicate that they are integrated correctly. The changes are consistent with the existing pattern of handling eImageType values.

  • Ginger/Ginger/ValueExpression/ValueExpressionEditorPage.xaml.cs
  • Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of new enum values in the codebase.

# Test: Search for the usage of new enum values. Expect: Occurrences where the new enum values are used correctly.
rg --type-add 'cs' --type 'cs' -e 'eImageType\.MoneyCheckDollar' -e 'eImageType\.AddressCard' -e 'eImageType\.IdCard' -e 'eImageType\.IdBadge' -e 'eImageType\.Phone'

Length of output: 223


Script:

#!/bin/bash
# Description: Verify the usage of new enum values in the codebase.

# Test: Search for the usage of new enum values. Expect: Occurrences where the new enum values are used correctly.
rg --type-add 'cs:*.cs' --type 'cs' -e 'eImageType\.MoneyCheckDollar' -e 'eImageType\.AddressCard' -e 'eImageType\.IdCard' -e 'eImageType\.IdBadge' -e 'eImageType\.Phone'

Length of output: 1330

Ginger/GingerCoreNET/ValueExpressionLib/ValueExpression.cs (2)

548-551: LGTM! Ensure the integration with CodeProcessor.GetBogusDataGenerateresult.

The new method EvaluateBogusDataGenrateFunctions looks good. Ensure that it correctly integrates with the CodeProcessor.GetBogusDataGenerateresult method and handles any potential errors.

Verification successful

Verified: Integration with CodeProcessor.GetBogusDataGenerateresult is correct.

The method EvaluateBogusDataGenrateFunctions correctly integrates with CodeProcessor.GetBogusDataGenerateresult, and its functionality is being tested in the unit tests.

  • Ginger/GingerCoreNET/ValueExpressionLib/ValueExpression.cs line 550
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `CodeProcessor.GetBogusDataGenerateresult` is correctly integrated within `EvaluateBogusDataGenrateFunctions`.

# Test: Search for the method usage. Expect: Only occurances within `EvaluateBogusDataGenrateFunctions`.
rg --type-add 'cs' --glob '!bin' --glob '!obj' 'CodeProcessor.GetBogusDataGenerateresult'

Length of output: 147


Script:

#!/bin/bash
# Description: Verify that `CodeProcessor.GetBogusDataGenerateresult` is correctly integrated within `EvaluateBogusDataGenrateFunctions`.

# Test: Search for the method usage. Expect: Only occurrences within `EvaluateBogusDataGenrateFunctions`.
rg --type-add 'cs:*.cs' --glob '!bin' --glob '!obj' 'CodeProcessor.GetBogusDataGenerateresult'

Length of output: 4721


240-241: Verify the usage of EvaluateBogusDataGenrateFunctions.

Ensure that the new method EvaluateBogusDataGenrateFunctions is correctly integrated into the Calculate method and that all necessary mock data expressions are evaluated properly.

Ginger/GingerCoreNET/RosLynLib/CodeProcessor.cs Outdated Show resolved Hide resolved
Ginger/GingerCoreNET/RosLynLib/CodeProcessor.cs Outdated Show resolved Hide resolved
Ginger/GingerCoreNET/RosLynLib/CodeProcessor.cs Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 693da16 and 6dd03c8.

Files selected for processing (1)
  • Ginger/GingerCoreNET/RosLynLib/CodeProcessor.cs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • Ginger/GingerCoreNET/RosLynLib/CodeProcessor.cs

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6dd03c8 and 5611a06.

Files selected for processing (1)
  • Ginger/GingerCoreNET/RosLynLib/CodeProcessor.cs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • Ginger/GingerCoreNET/RosLynLib/CodeProcessor.cs

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5611a06 and 96355b2.

Files selected for processing (1)
  • Ginger/GingerCoreNET/RosLynLib/CodeProcessor.cs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • Ginger/GingerCoreNET/RosLynLib/CodeProcessor.cs

@Maheshkale447 Maheshkale447 merged commit 2ece472 into master Jul 8, 2024
1 check passed
@Maheshkale447 Maheshkale447 deleted the Feature/MockDataGenerate branch July 8, 2024 16:55
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

Successfully merging this pull request may close these issues.

None yet

2 participants