Note that there are some explanatory texts on larger screens.

plurals
  1. POusing Moq - question
    primarykey
    data
    text
    <p>i have just started using Moq ver (3.1) and i have read blogs and what not.... anyway... i guess until you makes your hand dirty you will not learn :)</p> <p>okay here is what i'm testing...</p> <pre><code> var newProduct = new Mock&lt;IPartialPerson&gt;(); newProduct.SetupGet(p =&gt; p.FirstName).Returns("FirstName"); newProduct.SetupGet(p =&gt; p.MiddleName).Returns("MiddleName"); newProduct.SetupGet(p =&gt; p.LastName).Returns("LastName"); newProduct.SetupGet(p =&gt; p.EmailAddress).Returns("EmailAddress@hotmail.com"); newProduct.SetupGet(p =&gt; p.UserID).Returns("UserID"); //mock Escort repository var mockEscortRepository = new Mock&lt;IEscortRepository&gt;(); mockEscortRepository.Setup(p =&gt; p.LoadAllEscorts()) .Returns(newProduct.Object); //error </code></pre> <hr> <blockquote> <p>Error 1 The best overloaded method match for 'Moq.Language.IReturns>.Returns(System.Collections.Generic.List)' has some invalid arguments</p> </blockquote> <hr> <blockquote> <p>Error 2 Argument '1': cannot convert from 'App.Model.Interface.IPartialPerson' to 'System.Collections.Generic.List'</p> </blockquote> <hr> <pre><code>public interface IPartialPerson { string FirstName { get; } string MiddleName { get; } string LastName { get; } string EmailAddress { get; } string FullName { get; } string UserID { get; } } public interface IEscortRepository { List&lt;PartialPerson&gt; LoadAllEscorts(); List&lt;PartialPerson&gt; SelectedEscorts(List&lt;PartialPerson&gt; selectedEscorts); } </code></pre> <p>i have two methods that i want to test "LoadAllaEscorts" and "SelectedEscorts" </p> <p>how would i do a test for both methods?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload