Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jweber committed Jan 7, 2015
2 parents b35bc4f + a8a129d commit 8488b36
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .semver
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
:major: 2
:minor: 1
:patch: 0
:patch: 1
:special: ''
34 changes: 34 additions & 0 deletions source/WcfClientProxyGenerator.Tests/ProxyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,40 @@ public void Proxy_CanCallVoidMethod()
Assert.Fail("Timeout occurred when waiting for callback");
}

[Test, Description("github issue #12")]
public void Proxy_CanCallServiceMethod_ThatReturnsNull()
{
var mockService = new Mock<ITestService>();
mockService
.Setup(m => m.TestMethod(It.IsAny<string>()))
.Returns(() => null);

var serviceHost = InProcTestFactory.CreateHost<ITestService>(new TestServiceImpl(mockService));

var proxy = WcfClientProxy.Create<ITestService>(c => c.SetEndpoint(serviceHost.Binding, serviceHost.EndpointAddress));

string response = proxy.TestMethod("input");

Assert.That(response, Is.Null);
}

[Test, Description("github issue #12")]
public async Task AsyncProxy_CanCallServiceMethod_ThatReturnsNull()
{
var mockService = new Mock<ITestService>();
mockService
.Setup(m => m.TestMethod(It.IsAny<string>()))
.Returns(() => null);

var serviceHost = InProcTestFactory.CreateHost<ITestService>(new TestServiceImpl(mockService));

var proxy = WcfClientProxy.CreateAsyncProxy<ITestService>(c => c.SetEndpoint(serviceHost.Binding, serviceHost.EndpointAddress));

string response = await proxy.CallAsync(m => m.TestMethod("input"));

Assert.That(response, Is.Null);
}

[Test]
public void MultipleProxies_ReturnExpectedValues_WhenCallingServices()
{
Expand Down
4 changes: 2 additions & 2 deletions source/WcfClientProxyGenerator/RetryingWcfActionInvoker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ private void HandleOnBeforeInvoke(int retryCounter, InvokeInfo invokeInfo)
private void HandleOnAfterInvoke(int retryCounter, object response, InvokeInfo invokeInfo)
{
// set return value if non-void
if (invokeInfo != null && response.GetType() != typeof(VoidReturnType))
if (invokeInfo != null && response != null && response.GetType() != typeof(VoidReturnType))
{
invokeInfo.MethodHasReturnValue = true;
invokeInfo.ReturnValue = response;
Expand All @@ -374,7 +374,7 @@ private void HandleOnAfterInvoke(int retryCounter, object response, InvokeInfo i

private void HandleOnCallSuccess(TimeSpan callDuration, object response, int requestAttempts, InvokeInfo invokeInfo)
{
if (invokeInfo != null && response.GetType() != typeof (VoidReturnType))
if (invokeInfo != null && response != null && response.GetType() != typeof (VoidReturnType))
{
invokeInfo.MethodHasReturnValue = true;
invokeInfo.ReturnValue = response;
Expand Down

0 comments on commit 8488b36

Please sign in to comment.