Hi all,
I have the following generic method in my class:
1.private T ValidateApiResponse<T>(Document response) where T : ResponseBase2. {3. }My test method looks like this:
01.[TestMethod]02. public void CardCaptureRequest_CallsCreateRequest()03. {04. //Arrange05. var methodCalled = false;06. var facadeSettings = MockFacadeSettings("http://localhost", "logfile", 1, 2, "proxy");07. var authSettings = MockAuthenticationSettings("clientName", "password");08. var facade = Mock.Create<DatacashFacade>(Behavior.CallOriginal, new object[] { facadeSettings, authSettings });09. var document = Mock.Create<Document>();10. var ccResponse = new CardCaptureResponse11. {12. Status = 1,13. DatacashReference = "refNo",14. Information = "Info",15. MerchantReference = "merchRef",16. RedirectUrl = "http://localhost/",17. Success = true18. };19. 20. Mock.NonPublic.Arrange<Document>(facade, "CreateRequest")21. .DoInstead(() =>22. {23. methodCalled = true;24. }).Returns(document);25. Mock.NonPublic.Arrange<Document>(facade, "SendRequest")26. .IgnoreInstance().Returns(document);27. 28. Mock.NonPublic.Arrange<CardCaptureResponse>(facade, "ValidateApiResponse", document)29. .Returns(ccResponse);30. 31. //Act32. facade.CardCaptureRequest(1, "", 2, "", "", "");33. 34. //Assert35. Assert.IsTrue(methodCalled);36. }Line 28 is attempting to Mock the private method call.
However, the test fails with the following: Method 'ValidateApiResponse' with the given signature was not found on type .......
Any ideas??