0

I want to translate from JustMock syntax to MOQ :

JustMock :

Mock<Entities> model = new Mock<Entities>();
Mock.Arrange(() => model.Components).IgnoreInstance().ReturnsCollection(this.FakeComponent());

I try:

model.Setup(x => x.Components).Returns(this.FakeComponent());

but fail, Please help me!

Thinh
  • 15
  • 3

1 Answers1

2

If Components is a just a property, you'll need to use SetupGet:

model.SetupGet(x => x.Components).Returns(this.FakeComponent());

Setup is only for methods.

Patrick Quirk
  • 23,334
  • 2
  • 57
  • 88
  • @Thinh, No problem. If this resolved your question, don't forget to click the big checkbox saying so. This helps people later on who come across this with the same question! – Patrick Quirk Aug 14 '14 at 12:13