[tests][link sdk] Add tests to validate default properties for all (3) handlers that we ship (#177)
This commit is contained in:
Родитель
6ea42d2196
Коммит
d479ed00c7
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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>
|
||||
|
@ -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">
|
||||
|
|
Загрузка…
Ссылка в новой задаче