I want to check the code:
public ViewModel FillClientCreateViewModel(ViewModel model){ model.Phone = new Phone { Name = "Test"}; model.Phone = _entityInitializer.FillViewModel(model.Phone); }
I also want to configure the FillViewModel to return the same object as me.
My test:
entityInitMock.Setup(x => x.FillViewModel(It.IsAny<PhoneViewModel>())).Returns(It.IsAny<PhoneViewModel>()); var result = TestedInstance.FillClientCreateViewModel(CreateViewModel); result.Phone.Name.ShouldBe("Test");
But in this case, my test fell - because result.Phone.Name was cleared by my layout.
How to customize the layout to just give me the same object that I give it.
source share