我有以下的單元測試,我正在使用MOQ來設置從一個類返回的對象。然而,當我嘗試引用mock.Object它引用的接口類型不是我試圖返回Moq返回一個方法的對象
var throughFareIdentifer = new ThoroughfareNumberIdentifier();
var throughfareMock = new Mock<ILLUSiteInformation>();
throughfareMock.Setup(x => x.GetThroughfareNumber("15")).Returns(throughFareIdentifer);
var siteInformation = _lluSiteInformation.GetSiteDetails("", "", "", "", "", "", "", "", throughfareMock.Object);
throughfareMock.Object應ThroughfareNumberIdentifier不IlluSiteInformation類型。
任何幫助,這將不勝感激
感謝
克里斯
請提供[MCVE]與你實際的和預期的行爲。這將用於幫助你解決你的問題。 – Nkosi