KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an abstract class whose constructor needs 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 item from collection passed to constructor must implement: public interface IDate { DateTime Date { get; } } If I would write my custom mock it would look like this: public class QuoteCollectionMock : QuoteCollection<SomeIDateType> { public QuoteCollectionMock(IEnumerable<SomeIDateType> quotes) : base(quotes) { } } Can I achieve this with Moq ?
Tags (comma-separated)
Save Edits
Cancel