I have an abstract class whose constructor needs a collection argument. How can I mock my class to test it?
public abstract class QuoteCollection<T> : IEnumerable<T> where T : IDate { public QuoteCollection(IEnumerable<T> quotes) { //... } public DateTime From { get { ... } } public DateTime To { get { ... } } }
Each element from the collection passed to the constructor must implement:
public interface IDate { DateTime Date { get; } }
If I write my own layout, it will look like this:
public class QuoteCollectionMock : QuoteCollection<SomeIDateType> { public QuoteCollectionMock(IEnumerable<SomeIDateType> quotes) : base(quotes) { } }
Can I achieve this with Moq?
source share