Replies: 1 comment 3 replies
-
@AleyCZ you can use the other overload of [Fact]
public void Foo()
{
var fixture = new Fixture();
var strings = fixture.Create(typeof(string[]), new SpecimenContext(fixture)); ;
Assert.IsType<string[]>(strings);
} if you want to skip creating specimen context you can easily create an extension method. internal static class FixtureExtensions
{
public static object Create(this ISpecimenBuilder specimen, Type type)
{
return specimen.Create(type, new SpecimenContext(specimen));
}
} this is btw the same thing that |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need to be able to do
Fixture.Create(Type)
instead ofFixture.Create<T>()
. How that can be done?Simply said, I want to create a fake object having only the
Type
instance received as a parameter.(I use AutoFixute.AutoNSubstitute if that is important.)
Example:
Beta Was this translation helpful? Give feedback.
All reactions