public void Constructor3() { TestDataAssert.Execute( TestData.RepresentativeValueAndRefTypeTestDataCollection, (type, obj) => { foreach (HttpMethod httpMethod in HttpTestData.AllHttpMethods) { foreach (Uri uri in TestData.UriTestData) { foreach (IEnumerable <MediaTypeFormatter> formatterCollection in HttpTestData.AllFormatterCollections) { MediaTypeFormatter[] formatters = formatterCollection.ToArray(); HttpRequestMessage request = GenericTypeAssert.InvokeConstructor <HttpRequestMessage>( httpRequestMessageOfTType, type, new Type[] { type, typeof(HttpMethod), typeof(Uri), typeof(IEnumerable <MediaTypeFormatter>) }, new object[] { obj, httpMethod, uri, formatters }); GenericTypeAssert.IsCorrectGenericType <HttpRequestMessage>(request, type); Assert.AreEqual(uri, request.RequestUri, "Uri property was not set."); Assert.AreEqual(httpMethod, request.Method, "Method property was not set."); ObjectContentAssert.IsCorrectGenericType(request.Content as ObjectContent, type); ObjectContentAssert.ContainsFormatters(request.Content as ObjectContent, formatters); } } } }); }
public void Constructor4() { TestDataAssert.Execute( TestData.RepresentativeValueAndRefTypeTestDataCollection, (type, obj) => { foreach (HttpStatusCode statusCode in HttpTestData.AllHttpStatusCodes) { foreach (IEnumerable <MediaTypeFormatter> formatterCollection in HttpTestData.AllFormatterCollections) { MediaTypeFormatter[] formatters = formatterCollection.ToArray(); HttpResponseMessage response = GenericTypeAssert.InvokeConstructor <HttpResponseMessage>( httpResponseMessageOfTType, type, new Type[] { type, typeof(HttpStatusCode), typeof(IEnumerable <MediaTypeFormatter>) }, new object[] { obj, statusCode, formatters }); Assert.AreEqual(statusCode, response.StatusCode, "StatusCode was not set."); GenericTypeAssert.IsCorrectGenericType <HttpResponseMessage>(response, type); ObjectContentAssert.IsCorrectGenericType(response.Content as ObjectContent, type); ObjectContentAssert.ContainsFormatters(response.Content as ObjectContent, formatters); } } }); }
public void Constructor() { TestDataAssert.Execute( TestData.RepresentativeValueAndRefTypeTestDataCollection, (type, obj) => { HttpRequestMessage request = GenericTypeAssert.InvokeConstructor <HttpRequestMessage>( httpRequestMessageOfTType, type); GenericTypeAssert.IsCorrectGenericType <HttpRequestMessage>(request, type); Assert.IsNotNull(request.Content, "default contructor should have set Content."); }); }
public void Constructor1() { TestDataAssert.Execute( TestData.RepresentativeValueAndRefTypeTestDataCollection, (type, obj) => { HttpRequestMessage request = GenericTypeAssert.InvokeConstructor <HttpRequestMessage>( httpRequestMessageOfTType, type, new Type[] { type }, new object[] { obj }); GenericTypeAssert.IsCorrectGenericType <HttpRequestMessage>(request, type); ObjectContentAssert.IsCorrectGenericType(request.Content as ObjectContent, type); }); }
public void Constructor() { TestDataAssert.Execute( TestData.RepresentativeValueAndRefTypeTestDataCollection, (type, obj) => { foreach (HttpStatusCode statusCode in HttpTestData.AllHttpStatusCodes) { HttpResponseMessage response = GenericTypeAssert.InvokeConstructor <HttpResponseMessage>( httpResponseMessageOfTType, type, statusCode); GenericTypeAssert.IsCorrectGenericType <HttpResponseMessage>(response, type); Assert.IsNotNull(response.Content, "default contructor should have set Content."); Assert.AreEqual(statusCode, response.StatusCode, "StatusCode was not set."); } }); }
public void Constructor2() { TestDataAssert.Execute( TestData.RepresentativeValueAndRefTypeTestDataCollection, (type, obj) => { foreach (HttpStatusCode statusCode in HttpTestData.AllHttpStatusCodes) { HttpResponseMessage response = GenericTypeAssert.InvokeConstructor <HttpResponseMessage>( httpResponseMessageOfTType, type, new Type[] { type, typeof(HttpStatusCode) }, new object[] { obj, statusCode }); GenericTypeAssert.IsCorrectGenericType <HttpResponseMessage>(response, type); ObjectContentAssert.IsCorrectGenericType(response.Content as ObjectContent, type); Assert.AreEqual(statusCode, response.StatusCode, "StatusCode was not set."); } }); }
public void Constructor2() { TestDataAssert.Execute( TestData.RepresentativeValueAndRefTypeTestDataCollection, (type, obj) => { foreach (IEnumerable <MediaTypeFormatter> formatterCollection in HttpTestData.AllFormatterCollections) { MediaTypeFormatter[] formatters = formatterCollection.ToArray(); HttpRequestMessage request = GenericTypeAssert.InvokeConstructor <HttpRequestMessage>( httpRequestMessageOfTType, type, new Type[] { type, typeof(IEnumerable <MediaTypeFormatter>) }, new object[] { obj, formatters }); GenericTypeAssert.IsCorrectGenericType <HttpRequestMessage>(request, type); ObjectContentAssert.IsCorrectGenericType(request.Content as ObjectContent, type); ObjectContentAssert.ContainsFormatters(request.Content as ObjectContent, formatters); } }); }
public static void IsCorrectGenericType(ObjectContent objectContent, Type genericTypeParameter) { GenericTypeAssert.IsCorrectGenericType <ObjectContent>(objectContent, genericTypeParameter); Assert.AreEqual(genericTypeParameter, objectContent.Type, "objectContent.Type did not match its generic parameter."); }