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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created DefaultValueGenerator<T> class to handle construction of problematic types #521
Conversation
Looks great @Pvlerick! It looks this is a breaking change, since the deleted classes are public. Would it make sense to keep those classes (either as-is, or use the new class as an implementation?). |
@adamchester you are totally right, it was heavy handed to delete these two 馃憥 What about marking them as obsolete? |
Obsolete sounds good. |
778aa35
to
17f18d7
Compare
I marked both |
Do we need a new class for this? Isn't it enough to compose an new FilteringSpecimenBuilder(
new FixedBuilder(value),
new ExactTypeSpecification(type))); |
Looks like it 馃憤 I will simplify tomorrow and update the PR. |
@Pvlerick: 馃憤 |
Regarding Obsolete, I thought in the past we actually added |
We still do. The code is still there, so should still be covered by tests, but we don't want the compiler warnings from our tests. |
I looked at another In any event, I'll update the PR and restore the tests. Thank you for the guidance 馃憤 |
The progression is this:
I think that HTH |
0860ef1
to
8edbae2
Compare
Makes sense, thanks for clarifying. I updated the pull request accordingly. |
Assert.IsAssignableFrom<ISpecimenBuilder>(sut); | ||
} | ||
|
||
[Fact] | ||
public void CreateWithNullRequestWillReturnNoSpecimen() | ||
{ | ||
#pragma warning disable 618 | ||
var sut = new InvariantCultureGenerator(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't there be a #pragma warning restore 618
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I missed it, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ploeh Fixed.
馃憤 |
8edbae2
to
227e0ba
Compare
Thank you for your contribution! It's now live as AutoFixture 3.40.0. |
In #490, I mentioned that
System.Net.IPAddress
was also a problematic type that AutoFixture wasn't able to create.I started out by creating a new type to handle
IPAddress
specifically just asCulstureInfo
andEncoding
(#512) were handled, but it very quickly looked like code duplication (rule of three, I guess).So I went ahead and created a new generic type that has a constructor taking a default value and the
Create
method will always return that default value. I deleted the previous generators and moved relevant tests in the new class' tests.Open questions:
DefaultValueGenerator
name sound good? I started out withCustomGenerator
but changed my mind half-way, naming is hard 馃槃CC @tiesmaster