Forum Discussion

kpandidurai's avatar
kpandidurai
New Contributor
6 years ago
Solved

Null Value testing

I have 3 input parameter in SOPA project. I want to test what happens when a null value is passed to one of the string. Is there a way to pass a null string. <soapenv:Envelope xmlns:soapenv="http...
  • JHunt's avatar
    6 years ago

    In this case you are actually asking a question about the C# side of your code, so I'm not sure you can get a definitive answer here. In XML, xsi:nil="true" does represent a NULL, but your C# library might be returning a different value. It may not be one of the potential results for your library at all, in which case you don't have a valid test case.

     

    The things to test for from the client side is how your API will respond to each of ....

    <lib:lib:fooC></lib:lib:fooC>
    <lib:lib:fooC/>
    <lib:lib:fooC xsi:nil="true"/>

    Remember, your xml document must include the name space declaration:
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <!-- lib:lib:fooC/-->

    (There may be no difference between the first two).

     

    If all of these get the response you expect, and none of them trigger that branch in your C# code, then it probably is just dead code (code that will never be called) and probably should be removed.