Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Endpoint detector tests: also make sure the status code has a value.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Friesen committed May 19, 2014
1 parent abc8b59 commit 465f4c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions Rock.Core.IntegrationTests/Net/EndpointDetectorTests.cs
Expand Up @@ -16,6 +16,7 @@ public void ReturnsSuccessfulEndpointStatusWhenTheHttpEndpointIsReachable()

Assert.That(result.Endpoint, Is.EqualTo(google));
Assert.That(result.Success, Is.True);
Assert.That(result.StatusCode.HasValue, Is.True);
}

[Test]
Expand All @@ -29,6 +30,7 @@ public void ReturnsSuccessfulEndpointStatusWhenTheHttpsEndpointIsReachable()

Assert.That(result.Endpoint, Is.EqualTo(google));
Assert.That(result.Success, Is.True);
Assert.That(result.StatusCode.HasValue, Is.True);
}

[Test]
Expand Down
22 changes: 11 additions & 11 deletions Rock.Core/DependencyInjection/AutoContainer.cs
Expand Up @@ -131,17 +131,17 @@ private Func<object> GetCreateInstanceFunc(Type type)
// use this.Get<parameter_type>()
// else
// use the parameter's default value)
var createInstanceExpression =
Expression.Lambda<Func<object>>(
Expression.New(ctor,
ctor.GetParameters()
.Select(p =>
CanResolve(p.ParameterType)
? (Expression)Expression.Call(
thisExpression,
_getMethod.Value.MakeGenericMethod(p.ParameterType))
: Expression.Constant(p.DefaultValue, p.ParameterType))));

var createInstanceExpression =
Expression.Lambda<Func<object>>(
Expression.New(ctor,
ctor.GetParameters()
.Select(p =>
CanResolve(p.ParameterType)
? (Expression)Expression.Call(
thisExpression,
_getMethod.Value.MakeGenericMethod(p.ParameterType))
: Expression.Constant(p.DefaultValue, p.ParameterType))));

return createInstanceExpression.Compile();
}
Expand Down

0 comments on commit 465f4c0

Please sign in to comment.