diff --git a/src/Microsoft.AspNet.TestHost/ClientHandler.cs b/src/Microsoft.AspNet.TestHost/ClientHandler.cs
index 78afb19a28..add6bf48be 100644
--- a/src/Microsoft.AspNet.TestHost/ClientHandler.cs
+++ b/src/Microsoft.AspNet.TestHost/ClientHandler.cs
@@ -12,6 +12,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Http;
+using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.TestHost
{
@@ -28,13 +29,8 @@ namespace Microsoft.AspNet.TestHost
/// Create a new handler.
///
/// The pipeline entry point.
- public ClientHandler(Func next, PathString pathBase)
+ public ClientHandler([NotNull] Func next, PathString pathBase)
{
- if (next == null)
- {
- throw new ArgumentNullException("next");
- }
-
_next = next;
// PathString.StartsWithSegments that we use below requires the base path to not end in a slash.
@@ -53,14 +49,9 @@ namespace Microsoft.AspNet.TestHost
///
///
protected override async Task SendAsync(
- HttpRequestMessage request,
+ [NotNull] HttpRequestMessage request,
CancellationToken cancellationToken)
{
- if (request == null)
- {
- throw new ArgumentNullException("request");
- }
-
var state = new RequestState(request, _pathBase, cancellationToken);
var requestContent = request.Content ?? new StreamContent(Stream.Null);
var body = await requestContent.ReadAsStreamAsync();
diff --git a/src/Microsoft.AspNet.TestHost/RequestBuilder.cs b/src/Microsoft.AspNet.TestHost/RequestBuilder.cs
index 77344da496..3de390f63a 100644
--- a/src/Microsoft.AspNet.TestHost/RequestBuilder.cs
+++ b/src/Microsoft.AspNet.TestHost/RequestBuilder.cs
@@ -7,6 +7,7 @@ using System.Globalization;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
+using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.TestHost
{
@@ -26,13 +27,8 @@ namespace Microsoft.AspNet.TestHost
///
///
[SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings", Justification = "Not a full URI")]
- public RequestBuilder(TestServer server, string path)
+ public RequestBuilder([NotNull] TestServer server, string path)
{
- if (server == null)
- {
- throw new ArgumentNullException("server");
- }
-
_server = server;
_req = new HttpRequestMessage(HttpMethod.Get, path);
}
@@ -42,13 +38,8 @@ namespace Microsoft.AspNet.TestHost
///
///
///
- public RequestBuilder And(Action configure)
+ public RequestBuilder And([NotNull] Action configure)
{
- if (configure == null)
- {
- throw new ArgumentNullException("configure");
- }
-
configure(_req);
return this;
}
diff --git a/src/Microsoft.AspNet.TestHost/ResponseStream.cs b/src/Microsoft.AspNet.TestHost/ResponseStream.cs
index 5946117ab2..42a8a419c5 100644
--- a/src/Microsoft.AspNet.TestHost/ResponseStream.cs
+++ b/src/Microsoft.AspNet.TestHost/ResponseStream.cs
@@ -8,6 +8,7 @@ using System.Diagnostics.Contracts;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
+using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.TestHost
{
@@ -28,12 +29,8 @@ namespace Microsoft.AspNet.TestHost
private Action _onFirstWrite;
private bool _firstWrite;
- internal ResponseStream(Action onFirstWrite)
+ internal ResponseStream([NotNull] Action onFirstWrite)
{
- if (onFirstWrite == null)
- {
- throw new ArgumentNullException("onFirstWrite");
- }
_onFirstWrite = onFirstWrite;
_firstWrite = true;
diff --git a/src/Microsoft.AspNet.TestHost/project.json b/src/Microsoft.AspNet.TestHost/project.json
index 28acab776a..c32b8f617b 100644
--- a/src/Microsoft.AspNet.TestHost/project.json
+++ b/src/Microsoft.AspNet.TestHost/project.json
@@ -2,7 +2,8 @@
"version": "1.0.0-*",
"description": "ASP.NET 5 web server for writing and running tests.",
"dependencies": {
- "Microsoft.AspNet.Hosting": "1.0.0-*"
+ "Microsoft.AspNet.Hosting": "1.0.0-*",
+ "Microsoft.Framework.NotNullAttribute.Internal": { "version": "1.0.0-*", "type": "build" }
},
"frameworks": {
"dnx451": {