Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions tests/linker-ios/link sdk/HttpClientHandlerTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Tests to ensure consistency of our handlers across updates
//
// Copyright 2016 Xamarin Inc.

using System;
using System.Net;
using System.Net.Http;
#if XAMCORE_2_0
using Foundation;
#else
using MonoTouch.Foundation;
#endif
using NUnit.Framework;

namespace LinkSdk.Net.Http {

[TestFixture]
[Preserve (AllMembers = true)]
public class HttpClientHandlerTest {

[Test]
public void HttpClient ()
{
using (var handler = new HttpClientHandler ()) {
Assert.True (handler.AllowAutoRedirect, "AllowAutoRedirect");
Assert.NotNull (handler.CookieContainer, "CookieContainer");
Assert.Null (handler.Credentials, "Credentials");
// (so far) not exposed in other, native handlers
Assert.That (handler.AutomaticDecompression, Is.EqualTo (DecompressionMethods.None), "AutomaticDecompression");
Assert.That (handler.ClientCertificateOptions, Is.EqualTo (ClientCertificateOption.Manual), "ClientCertificateOptions");
Assert.That (handler.MaxAutomaticRedirections, Is.EqualTo (50), "MaxAutomaticRedirections");
Assert.That (handler.MaxRequestContentBufferSize, Is.EqualTo (Int32.MaxValue), "MaxRequestContentBufferSize");
Assert.Null (handler.Proxy, "Proxy");
Assert.True (handler.SupportsAutomaticDecompression, "SupportsAutomaticDecompression");
Assert.True (handler.SupportsProxy, "SupportsProxy");
Assert.True (handler.SupportsRedirectConfiguration, "SupportsRedirectConfiguration");
Assert.True (handler.UseCookies, "UseCookies");
Assert.False (handler.UseDefaultCredentials, "UseDefaultCredentials");
Assert.True (handler.UseProxy, "UseProxy");
}
}

[Test]
public void CFNetwork ()
{
using (var handler = new CFNetworkHandler ()) {
Assert.True (handler.AllowAutoRedirect, "AllowAutoRedirect");
Assert.NotNull (handler.CookieContainer, "CookieContainer");
// custom, not in HttpClientHandler
Assert.False (handler.UseSystemProxy, "UseSystemProxy");
}
}

[Test]
public void NSUrlSession ()
{
using (var handler = new NSUrlSessionHandler ()) {
Assert.True (handler.AllowAutoRedirect, "AllowAutoRedirect");
Assert.Null (handler.Credentials, "Credentials");
// custom, not in HttpClientHandler
Assert.False (handler.DisableCaching, "DisableCaching");
}
}
}
}
2 changes: 2 additions & 0 deletions tests/linker-ios/link sdk/link sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
</MtouchI18n>
<MtouchExtraArgs>-v -v -disable-thread-check -xml=${ProjectDir}/extra-linker-defs.xml</MtouchExtraArgs>
<MtouchArch>i386</MtouchArch>
<MtouchLink>SdkOnly</MtouchLink>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
Expand Down Expand Up @@ -112,6 +113,7 @@
<Compile Include="DllImportTest.cs" />
<Compile Include="LocaleTest.cs" />
<Compile Include="ReflectionTest.cs" />
<Compile Include="HttpClientHandlerTest.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\BundledResources\BundledResources.csproj">
Expand Down