question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Non-generic Fake and Dummy creation

See original GitHub issue

I just realized that A.Fake doesn’t have a non-generic overload accepting a Type parameter, which would be very useful in some scenarios. I realize that it’s not something most people would need on a regular basis, but there doesn’t seem to be a good workaround. The only way I found was to call A.Fake<T>() via reflection, which is far from ideal.

Am I missing something?

Perhaps adding a non-generic overload to A.Fake wouldn’t be the best option, because would pollute the API with something that is not usually useful, but it would be nice to have an easy workaround.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:42 (39 by maintainers)

github_iconTop GitHub Comments

1reaction
blairconradcommented, Jun 10, 2016

I’m for reopening.

One oddball person coming out of nowhere and requesting the feature is one matter, but now that we have two such people, it appears that the feature would fill a desperate need. And who knows, maybe someday @ploeh will not mind taking a dependency on a modern FakeItEasy and he can have prettier code in AutoFixture.

0reactions
blairconradcommented, Jun 20, 2016

This issue has been fixed in release 2.1.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dummies
For cases where the type of dummy isn't statically known, non-generic ... When creating Fakes or Dummies of class types, FakeItEasy needs to...
Read more >
Mocking generic methods in Moq without specifying T
I would like to mock the class that contains this method without having to specify Setup methods for every type it could be...
Read more >
How to Generate Test Data/Dummy Data/ Fake data/ Mock ...
In the above example, I am creating an object of Bogus.Faker class. Faker is a generic class that takes class as a generic...
Read more >
mockall - Rust
A powerful mock object library for Rust. Mockall provides tools to create mock versions of almost any trait or struct. They can be...
Read more >
Generics
Generics are used for metaprogramming in Ada. They are useful for abstract algorithms that share common properties with each other. Either a subprogram...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found