locked
How to write a test case for a out parameter service contract using fakes. RRS feed

  • Question

  • Hi,

    I need to write a test case by faking the one of the service which have one out parameter. I tried to fake the out parameter contract method by having "out" prefixed by the variable, but its still showing that 'Identifier expected' .

    Here is the code,

    TestService.Fakes.ShimTestServiceClient.AllInstances.GetStateStringStringErrorOur = (a, b, c,out d) => { return 1; };

    After d variable its showing Identifier expected.

    Could some one please help me here to resolve the issue.

    Thanks in advance.

    Wednesday, April 6, 2016 11:42 AM

Answers

  • Here is the implementation for out parameter service contract.

    While doing fakes the service contract we have to  mention the parameter type like string/int/Object..etc.

    TestService.Fakes.ShimTestServiceClient.AllInstances.GetStateStringStringErrorOur = (TestServiceClient a,int b, ,out string d) => {

    d="Test";

    ;return true; };

    Thanks.

    Wednesday, April 13, 2016 9:37 AM

All replies

  • Hi,

    If possible, please share us a simple code and provide us the complete error messages so that we could better troubleshoot your issue.

    By the way, please take a look at this simpe code in the following document:

    https://msdn.microsoft.com/en-us/library/hh549175.aspx

    Thanks for your understanding.

    Best Regards,

    Lake Xiao

    Thursday, April 7, 2016 3:08 AM
  • Here is the implementation for out parameter service contract.

    While doing fakes the service contract we have to  mention the parameter type like string/int/Object..etc.

    TestService.Fakes.ShimTestServiceClient.AllInstances.GetStateStringStringErrorOur = (TestServiceClient a,int b, ,out string d) => {

    d="Test";

    ;return true; };

    Thanks.

    Wednesday, April 13, 2016 9:37 AM