I am testing a public API however, internally my API is calling a function with signature like
protected internal virtual void AddBook(Book book)
{
if (null !=book)
bookList= book;
}
And bookList is also defined as
public virtual BookInformation bookList{ get; protected internal set; }
I need to set this bookList. I can do it either using function AddBook or directly accessing bookList. bookList is also defined as "protected internal set
".
I tried
var mockModule = new Mock<myModule> { CallBase = true };
mockModule.Protected()
.Setup<Book>("AddBook", book);
But I get error that "AddBook" does not exist.
Any ideas what am I missing?
Update I was pressed against deadline so I ended up mocking the class. This solved my problem for now.