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

Integer property WithInRange method not in range ☺️ #151

Closed
mfarkan opened this issue Jan 8, 2020 · 3 comments
Closed

Integer property WithInRange method not in range ☺️ #151

mfarkan opened this issue Jan 8, 2020 · 3 comments
Assignees

Comments

@mfarkan
Copy link

mfarkan commented Jan 8, 2020

I'm writing unit tests and my genfu class is like that ;

 public static ApplicationUser GetUser()
        {
            A.Configure<ApplicationUser>()
                .Fill(q => q.AccessFailedCount).WithinRange(0, 3)
                .Fill(q => q.Email, q => { return string.Format("{0}.{1}@gmail.com", q.UserName, q.PhoneNumber); })
                .Fill(q => q.PhoneNumber, "905384811896")
                .Fill(q => q.CreatedAt, DateTime.Now)
                .Fill(q => q.Gender, Core.Enumarations.Gender.Female)
                .Fill(q => q.EmailConfirmed, true)
                .Fill(q => q.PhoneNumberConfirmed, true)
                .Fill(q => q.Id, new Guid("FFC42A97-C75D-4F8B-85D7-9044BE829755"));
            return A.New<ApplicationUser>();
        }
AccessFailedCount = 32
AccessFailedCount = 72
AccessFailedCount = 64
AccessFailedCount = 5
AccessFailedCount = 6
AccessFailedCount = 95

And It's keep going like that.

My app running on .net core 3.1.

Thank you ! 👍

@dpaquette dpaquette added the bug label Jan 8, 2020
@dpaquette dpaquette self-assigned this Jan 8, 2020
@dpaquette
Copy link
Collaborator

Working on a fix and have identified the source of the problem. See PR #153

@mfarkan
Copy link
Author

mfarkan commented Jan 14, 2020

thank you ! what is the cause of this ? I review your code but i didn't understand it.

@dpaquette
Copy link
Collaborator

It had to do with how WithinRange was registering the property filler for the ApplicationUser type but the AccessFailedCount property is actually defined on the base class.

I did a live stream while I tried to reproduce this bug and eventually found the source of the problem. You can watch it here if you're interested: https://www.youtube.com/watch?v=IuKhMSx1a7A

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

No branches or pull requests

2 participants