Questions tagged [automoq]

Auto mocking provider for Moq

AutoMoq is an "auto-mocking" container that automatically creates any fake objects that are necessary to instantiate the class under test.

Developer can access those fakes through the mocker, or developer can just ignore them if they're not important.

80 questions
0
votes
0 answers

Error while trying to unit test a sqlfunction: Unable to verify the expression, invoked 0 times

I'm trying to unit test a sql function for my application, but when i try to verify the method is only called once, it gives an error saying the method isn't called at all. I'm using moq to mock my different contexts and interfaces. The method is…
0
votes
0 answers

AutoMoq to respect MaxLengthAttribute

I'm using AutoFixture with AutoMoq to generate and configure a Mock to an interface. This interface uses the MaxLength attribute to specify the maximum length each property. How can I make the generated mock respect the MaxLength attribute. Please,…
SuperJMN
  • 13,110
  • 16
  • 86
  • 185
0
votes
0 answers

Automoq create object without calling a constructor

Is there a way in Automoq to do what FormatterServices.GetUninitializedObject() does? I have a class that let's just say is not written in the best way and I just have to get through creating that class's object using Automoq, but I ran into a ctor…
fahadash
  • 3,133
  • 1
  • 30
  • 59
0
votes
2 answers

Pass property of generic class as parameter in AutoMoq

What I'm trying to do is generalize making repositories using AutoFixture and Moq. I have a method called 'add' that adds fake records to a list. The list is called records and is global to the class. The generic M is a model to be mocked. The…
Aaron Gates
  • 469
  • 4
  • 15
0
votes
2 answers

Get Mock with AutoMock.Create<>()

I am using the AutoMock integration of Autofaq and Moq Is there a way to get a mock from AutoMock.Create()? The reason I want this, is to mock some methods of the class under test (Service) like shown here and also keep the automatic…
chaliasos
  • 9,659
  • 7
  • 50
  • 87
1 2 3 4 5
6