1

When I create my moq mock and try to pass it into my class constructor I get this message: Argument type Moq.Mock<...mockIAppCache> is not assingable to paramter type 'IAppCache'. I included the library and I can find the reference to Mock() ok. Am I missing something here?

    [TestMethod]
    public void SomeTestMethod()
    {
        var mockIAppCache = new Mock<IAppCache>();
        var mockISeries = new Mock<ISeries>();

        ReportFR2 report = new ReportFR2(SeriesKey.FR2, mockIAppCache);
        DateTime resolvedDate = report.ResolveDate(mockISeries, DateTime.Now);

        //Assert.AreEqual("something", "something");

    }
chuckd
  • 13,460
  • 29
  • 152
  • 331

1 Answers1

3

I believe you need to pass the mock like this:

ReportFR2 report = new ReportFR2(SeriesKey.FR2, mockIAppCache.Object);
Simon MᶜKenzie
  • 8,344
  • 13
  • 50
  • 77
LeeWallen
  • 88
  • 8