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

Bogus.Tools.Analyzer When a class contains a property with a byte[], 'default' is output for the RuleFor() instead of Random.Bytes(1) #562

Open
mpickers opened this issue Aug 28, 2024 · 1 comment

Comments

@mpickers
Copy link

Bogus NuGet Package

35.6.0

.NET Version

net 6

Visual Studio Version

17.10.3

What operating system are you using?

Windows

What locale are you using with Bogus?

en_US

Problem Description

When a class contains a property with a byte[], 'default' is output for the RuleFor() instead of Random.Bytes(1)

LINQPad Example or Reproduction Steps

      public class ByteArray
      {
         public byte[] RowVersion { get; set; }
      }      

      static void BogusAnalyzer()
      {
         var g = new Faker<ByteArray>()
            .RuleFor(b => b.RowVersion, f => default);

         var o = g.Generate();
      }

Expected Behavior

Ideally it should set the RuleFor using the Random.Bytes(1)

         var g = new Faker<ByteArray>()
            .RuleFor(b => b.RowVersion, f => f.Random.Bytes(1));

Actual Behavior

Outputs default as the RuleFor()

Known Workarounds

No response

Could you help with a pull-request?

No

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
@mpickers and others