-
Notifications
You must be signed in to change notification settings - Fork 342
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
Fixture creates OmitSpecimens instead of default values #645
Comments
I don't think I even have an opinion on that matter 😳 There are some parts of the design of AutoFixture that, if you start doing weird things to it, will compile, but not necessarily do meaningful things at run-time. That's one disadvantage of an API which is, to be frank, quite weakly typed. Is there an underlying reason for this issue? |
Yep, the question itself sounds a bit strange but there is a reason :) I think the issue #343 can be solved using an omitter that would ignore the test method parameters with the NUnit's I'm experimenting with that here and now end up with the following exception: [Test, AutoData]
public void FixtureIgnoresParameterWithValuesAttribute([Values(1, -1)] int num)
{
Assert.True(num == -1 || num == 1); // fails
// System.ArgumentException : Unable to cast "Ploeh.AutoFixture.Kernel.OmitSpecimen"
// to "System.Int32".
} //cc: @steph4nc |
I was wrong, the omitter won't solve the issue #343 (there is another fix required), so if there is no other scenario when this particular fix could be used, I'm fine with closing the issue.
@ploeh, that is not the first time you mentioning this. It would be so great to know which parts you're talking about and whether it'll be improved in v4 :) |
It'd be a stretch to call this strongly typed: public interface ISpecimenBuilder
{
object Create(object request, ISpecimenContext context);
} or this: public interface ISpecimenCommand
{
void Execute(object specimen, ISpecimenContext context);
} I don't plan on changing it in version 4, though. It'd basically mean a rewrite if I were to change it, and in the end, I'd probably end up with FsCheck anyway, so I see no reason to do that... |
Is there anything else regarding this issue that ought to be addressed? |
Nope. Closed. |
In the
OmitSpecimen
documentation:Despite the explicit mentioning the Auto-Property feature here (which indicates that we're talking about specimen 'parts'), I have a strong feeling that the following test should pass:
The text was updated successfully, but these errors were encountered: