0

I don't know why this assert fails. When I get the response variable back and mouse over it, it seems to be the same type as the typeof yet this still fails. We're using MSTest (unfortunately) but just some background info here.

PreAuthorizeResponse response = serviceClient.PreAuthorize(preAuthorizeRequest);

// Assert
Assert.AreEqual(typeof(PreAuthorizeResponse), response);
PositiveGuy
  • 46,620
  • 110
  • 305
  • 471

1 Answers1

0

You are comparing reference to Type with reference to response, not its type. Corrected:

Assert.AreEqual(typeof(PreAuthorizeResponse), response.GetType());

You might want to read question Type Checking: typeof, GetType, or is? for further details.

Community
  • 1
  • 1
Konrad Kokosa
  • 16,563
  • 2
  • 36
  • 58
  • that's strange because in my TDD Unit Tests (non-integration) tests, it worked without adding GetType() – PositiveGuy Dec 04 '13 at 08:16
  • I think the AreEqual for the assert provides the GetType() for you – PositiveGuy Dec 04 '13 at 08:16
  • I would start from checking if adding `.GetType()` helps. – Konrad Kokosa Dec 04 '13 at 08:18
  • I will but it doesn't make sense that my existing code works in non-integration tests...but doesn't for tests that are going against the wsdl (in the integration tests) – PositiveGuy Dec 04 '13 at 14:41
  • It is indeed interesting taht it works in unit tests. Do you use MSTest in both test types? Maybe there is another not obvious difference, for example, how do you create response in unit tests etc. – Konrad Kokosa Dec 04 '13 at 15:12