Re: Unit Testing Save of editable stereotypes with Moq

Re: Unit Testing Save of editable stereotypes with Moq

Old forum URL: forums.lhotka.net/forums/t/12847.aspx


coding posted on Thursday, March 12, 2015

Hi

I tried using returning an actual child list through mock, it worked ! not sure if this is the correct approach , does it give any clue to serialization problem ?

// old mockchildlistFactory.Setup(_ => _.CreateChild()).Returns(mockchildlist.Object);

//new mockchildlistFactory.Setup(_ => _.CreateChild()).Returns(new ChildList ());

Do you have any code sample /article which shows how to do unit testing of save of editable root and editable root list child CRUD with MOQ ??

Suppose we save root editable object with child lists , basically what all steps we need to mock ? As I know calling save/saveasync will land on Dataportal_update, so do we need to mock child list for mocking as save operation will tend to save the entire object graph ?

Copyright (c) Marimer LLC