[macos][test][xammac_tests]Automate some of the previously manual mac tests (#1715)

This commit is contained in:
Timothy Risi 2017-03-17 16:28:16 -08:00 коммит произвёл GitHub
Родитель 1f81d9d13f
Коммит 35ff3ed182
30 изменённых файлов: 940 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,21 @@
using System;
using Foundation;
using AppKit;
using MyLibrary;
namespace BasicPCLTest
{
public partial class AppDelegate : NSApplicationDelegate
{
public AppDelegate ()
{
}
public override void DidFinishLaunching (NSNotification notification)
{
MyClass.DoIt ();
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
namespace BasicPCLTest
{
[global::Foundation.Register ("AppDelegate")]
public partial class AppDelegate
{
}
}

Просмотреть файл

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{3FBB6801-ACAC-4347-91FD-A09CF633BB21}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>BasicPCLTest</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>BasicPCLTest</AssemblyName>
<UseXamMacFullFramework>true</UseXamMacFullFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<UseRefCounting>true</UseRefCounting>
<UseSGen>true</UseSGen>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<EnablePackageSigning>false</EnablePackageSigning>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<UseRefCounting>true</UseRefCounting>
<UseSGen>true</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<CreatePackage>true</CreatePackage>
<CodeSigningKey>Developer ID Application</CodeSigningKey>
<EnableCodeSigning>true</EnableCodeSigning>
<EnablePackageSigning>false</EnablePackageSigning>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="AppDelegate.designer.cs">
<DependentUpon>AppDelegate.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyLibrary\MyLibrary.csproj">
<Project>{61393B2B-B0AF-4875-84E4-742DCCB87749}</Project>
<Name>MyLibrary</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>BasicPCLTest</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.your-company.BasicPCLTest</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>BasicPCLTest</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.8</string>
<key>NSHumanReadableCopyright</key>
<string>MM</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,16 @@
using System;
using AppKit;
namespace BasicPCLTest
{
static class MainClass
{
static void Main (string[] args)
{
NSApplication.Init ();
NSApplication.SharedApplication.Delegate = new AppDelegate ();
NSApplication.Main (args);
}
}
}

Просмотреть файл

@ -0,0 +1,30 @@
using System;
using System.IO;
using Newtonsoft.Json.Linq;
namespace MyLibrary
{
public class MyClass
{
public static void DoIt ()
{
JArray array = new JArray();
array.Add("Manual text");
array.Add(new DateTime(2000, 5, 23));
JObject o = new JObject();
o["MyArray"] = array;
var fileName = "../../../../../TestResult.txt";
if (File.Exists (fileName))
File.Delete (fileName);
using (TextWriter writer = File.CreateText (fileName)) {
writer.WriteLine (o);
}
Environment.Exit (0);
}
}
}

Просмотреть файл

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{61393B2B-B0AF-4875-84E4-742DCCB87749}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>MyLibrary</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>MyLibrary</AssemblyName>
<UseXamMacFullFramework>true</UseXamMacFullFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<UseRefCounting>false</UseRefCounting>
<UseSGen>false</UseSGen>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<CreatePackage>false</CreatePackage>
<EnableCodeSigning>false</EnableCodeSigning>
<EnablePackageSigning>false</EnablePackageSigning>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<UseRefCounting>false</UseRefCounting>
<UseSGen>false</UseSGen>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<CreatePackage>false</CreatePackage>
<EnableCodeSigning>false</EnableCodeSigning>
<EnablePackageSigning>false</EnablePackageSigning>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<Compile Include="MyClass.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,27 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("MyLibrary")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("MM")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
</packages>

Просмотреть файл

@ -0,0 +1,24 @@
using AppKit;
using Foundation;
using System;
namespace ImmutableCollection_Test {
[Register ("AppDelegate")]
public class AppDelegate : NSApplicationDelegate {
public AppDelegate ()
{
}
public override void DidFinishLaunching (NSNotification notification)
{
var v = System.Collections.Immutable.ImmutableList.Create (new int [] { 1, 2, 3 });
Environment.Exit (0);
// Insert code here to initialize your application
}
public override void WillTerminate (NSNotification notification)
{
// Insert code here to tear down your application
}
}
}

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{DA730957-774A-41A0-93A6-B4F0B91A035F}</ProjectGuid>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>ImmutableCollection_Test</RootNamespace>
<AssemblyName>ImmutableCollection_Test</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<UseXamMacFullFramework>true</UseXamMacFullFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<EnableCodeSigning>false</EnableCodeSigning>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<CreatePackage>false</CreatePackage>
<EnablePackageSigning>false</EnablePackageSigning>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<UseSGen>true</UseSGen>
<UseRefCounting>true</UseRefCounting>
<Profiling>true</Profiling>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>true</CreatePackage>
<EnablePackageSigning>false</EnablePackageSigning>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<UseSGen>true</UseSGen>
<UseRefCounting>true</UseRefCounting>
<LinkMode>None</LinkMode>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
<Reference Include="System.Collections.Immutable">
<HintPath>..\..\..\..\..\..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>ImmutableCollection_Test</string>
<key>CFBundleIdentifier</key>
<string>com.xamarin.immutablecollection_test</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.12</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSHumanReadableCopyright</key>
<string>Timothy Risi</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,12 @@
using AppKit;
namespace ImmutableCollection_Test {
static class MainClass {
static void Main (string [] args)
{
NSApplication.Init ();
NSApplication.SharedApplication.Delegate = new AppDelegate ();
NSApplication.Main (args);
}
}
}

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.Collections.Immutable" version="1.3.1" targetFramework="net45" />
</packages>

Просмотреть файл

@ -0,0 +1,70 @@
using System;
using Foundation;
using AppKit;
using ProtoBuf;
using System.IO;
namespace Protobuf_Test
{
public partial class AppDelegate : NSApplicationDelegate
{
public AppDelegate ()
{
}
public override void DidFinishLaunching (NSNotification notification)
{
ProtoTest.DoTest ();
}
}
static class ProtoTest {
[ProtoContract]
class Person {
[ProtoMember(1)]
public int Id {get;set;}
[ProtoMember(2)]
public string Name { get; set;}
[ProtoMember(3)]
public Address Address {get;set;}
}
[ProtoContract]
class Address {
[ProtoMember(1)]
public string Line1 {get;set;}
[ProtoMember(2)]
public string Line2 {get;set;}
}
public static void DoTest ()
{
var person = new Person {
Id = 12345, Name = "Fred",
Address = new Address {
Line1 = "Flat 1",
Line2 = "The Meadows"
}
};
using (var file = File.Create ("/tmp/person.bin")) {
Serializer.Serialize (file, person);
}
Person newPerson;
using (var file = File.OpenRead ("/tmp/person.bin")) {
newPerson = Serializer.Deserialize<Person> (file);
}
var fileName = "../../../../../TestResult.txt";
if (File.Exists (fileName))
File.Delete (fileName);
using (TextWriter writer = File.CreateText (fileName)) {
writer.WriteLine (newPerson.Name == "Fred" ? "Test Passed" : "Test Failed");
}
Environment.Exit (0);
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
namespace Protobuf_Test
{
[global::Foundation.Register ("AppDelegate")]
public partial class AppDelegate
{
}
}

Просмотреть файл

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>Protobuf_Test</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.your-company.Protobuf_Test</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Protobuf_Test</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.8</string>
<key>NSHumanReadableCopyright</key>
<string>MM</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,16 @@
using System;
using AppKit;
namespace Protobuf_Test
{
static class MainClass
{
static void Main (string[] args)
{
NSApplication.Init ();
NSApplication.SharedApplication.Delegate = new AppDelegate ();
NSApplication.Main (args);
}
}
}

Просмотреть файл

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{528162A2-5E0C-48ED-8F44-DB27633DDBF2}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Protobuf_Test</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>Protobuf_Test</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<UseXamMacFullFramework>true</UseXamMacFullFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<UseRefCounting>true</UseRefCounting>
<UseSGen>true</UseSGen>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<EnablePackageSigning>false</EnablePackageSigning>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<UseRefCounting>true</UseRefCounting>
<UseSGen>true</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<CreatePackage>true</CreatePackage>
<CodeSigningKey>Developer ID Application</CodeSigningKey>
<EnableCodeSigning>true</EnableCodeSigning>
<EnablePackageSigning>false</EnablePackageSigning>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
<Reference Include="System.Xml" />
<Reference Include="protobuf-net">
<HintPath>..\..\..\..\..\..\packages\protobuf-net.2.1.0\lib\net45\protobuf-net.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="AppDelegate.designer.cs">
<DependentUpon>AppDelegate.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="protobuf-net" version="2.1.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -0,0 +1,30 @@
using System;
using Foundation;
using AppKit;
using System.IO;
namespace ServiceModel_Test
{
public partial class AppDelegate : NSApplicationDelegate
{
public AppDelegate ()
{
}
public override void DidFinishLaunching (NSNotification notification)
{
var fileName = "../../../../../TestResult.txt";
if (File.Exists (fileName))
File.Delete (fileName);
using (TextWriter writer = File.CreateText (fileName)) {
var x = new System.ServiceModel.CommunicationException ();
writer.WriteLine ("Test Passed: " + x.ToString ());
}
Environment.Exit (0);
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
namespace ServiceModel_Test
{
[global::Foundation.Register ("AppDelegate")]
public partial class AppDelegate
{
}
}

Просмотреть файл

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>ServiceModel_Test</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.your-company.ServiceModel_Test</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>ServiceModel_Test</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.8</string>
<key>NSHumanReadableCopyright</key>
<string>MM</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,16 @@
using System;
using AppKit;
namespace ServiceModel_Test
{
static class MainClass
{
static void Main (string[] args)
{
NSApplication.Init ();
NSApplication.SharedApplication.Delegate = new AppDelegate ();
NSApplication.Main (args);
}
}
}

Просмотреть файл

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{C269BEF3-1685-4298-A4BC-87C4B63C0403}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ServiceModel_Test</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>ServiceModel_Test</AssemblyName>
<UseXamMacFullFramework>true</UseXamMacFullFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<UseRefCounting>true</UseRefCounting>
<UseSGen>true</UseSGen>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<EnablePackageSigning>false</EnablePackageSigning>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<UseRefCounting>true</UseRefCounting>
<UseSGen>true</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<CreatePackage>true</CreatePackage>
<CodeSigningKey>Developer ID Application</CodeSigningKey>
<EnableCodeSigning>true</EnableCodeSigning>
<EnablePackageSigning>false</EnablePackageSigning>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
<Reference Include="System.ServiceModel" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="AppDelegate.designer.cs">
<DependentUpon>AppDelegate.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
</Project>

Просмотреть файл

@ -283,6 +283,15 @@ namespace Xamarin.MMP.Tests
});
}
[Test]
public void BuildUnified45_ShouldAllowReferenceToOpenTK ()
{
RunMMPTest (tmpDir => {
TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) { References = " <Reference Include=\"OpenTK\" />", TestCode = "var matrix = new OpenTK.Matrix2 ();", XM45 = true };
TI.TestUnifiedExecutable (test);
});
}
[Test]
public void Dontlink_AllowsUnresolvableReferences ()
{
@ -605,6 +614,16 @@ namespace Xamarin.MMP.Tests
});
}
//https://testrail.xamarin.com/index.php?/cases/view/234141&group_by=cases:section_id&group_order=asc&group_id=51097
[Test]
public void Unified45Build_CompileToNativeOutput ()
{
RunMMPTest (tmpDir => {
TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) { XM45 = true };
var output = TI.TestUnifiedExecutable (test);
Assert.That (output.BuildOutput, Contains.Substring ("TargetFrameworkIdentifier: .NETFramework"));
Assert.That (output.BuildOutput, Contains.Substring ("TargetFrameworkVersion: v4.5"));
});
}
}
}

Просмотреть файл

@ -0,0 +1,63 @@
using System;
using NUnit.Framework;
using Xamarin.Bundler;
using System.Text;
using System.IO;
using Xamarin.MMP.Tests;
namespace MonoTouchFixtures.ServiceModel {
//https://testrail.xamarin.com/index.php?/cases/view/236768&group_by=cases:section_id&group_order=asc&group_id=72254
[TestFixture]
public class Net45 {
void RunMSBuildTest (Action<string> test)
{
string tmpDir = Path.Combine (Path.GetTempPath (), "msbuild-tests");
try {
Directory.CreateDirectory (tmpDir);
test (tmpDir);
} finally {
Directory.Delete (tmpDir, true);
}
}
[Test]
public void ShouldIncludeSystemServiceModel ()
{
StringBuilder output = new StringBuilder ();
int result = Driver.RunCommand ("/Library/Frameworks/Mono.framework/Versions/Current/Commands/monop", String.Format ("--refs -r:{0}/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/4.5/System.ServiceModel.dll", TI.FindRootDirectory ()), null, output);
Assert.That (result, Is.EqualTo (0));
Assert.That (output.ToString (), Contains.Substring ("System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"));
}
[Test]
public void ShouldNotIncludeSystemDrawing ()
{
StringBuilder output = new StringBuilder ();
int result = Driver.RunCommand ("/Library/Frameworks/Mono.framework/Versions/Current/Commands/monop", String.Format ("--refs -r:{0}/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/4.5/System.ServiceModel.dll", TI.FindRootDirectory ()), null, output);
Assert.That (result, Is.EqualTo (0));
Assert.That (output.ToString (), !Contains.Substring ("System.Drawing"));
}
[Test]
public void ServiceModelShouldCreateCommunicationException ()
{
var testFolder = "../../../../../../../common/mac/TestProjects/ServiceModel_Test/ServiceModel_Test";
var testResults = testFolder + "/TestResult.txt";
if (File.Exists (testResults))
File.Delete (testResults);
TI.BuildProject (testFolder + "/ServiceModel_Test.csproj", true);
TI.RunAndAssert (testFolder + "/bin/Debug/ServiceModel_Test.app/Contents/MacOS/ServiceModel_Test", null, "Run");
Assert.True (File.Exists (testResults));
using (TextReader reader = File.OpenText (testResults)) {
var output = reader.ReadLine ();
Assert.AreEqual ("Test Passed: System.ServiceModel.CommunicationException: System error.", output);
}
File.Delete (testResults);
}
}
}

Просмотреть файл

@ -0,0 +1,85 @@
using System;
using System.IO;
using NUnit.Framework;
using Xamarin.MMP.Tests;
using Xamarin.Bundler;
using System.Text;
namespace MonoTouchFixtures.Net45 {
[TestFixture]
public class Unified45 {
[Test]
public void ProtobufShouldSerializeAndDeserialize ()
{
var testFolder = "../../../../../../../common/mac/TestProjects/Protobuf_Test/Protobuf_Test";
var testResults = testFolder + "/TestResult.txt";
if (File.Exists (testResults))
File.Delete (testResults);
StringBuilder restoreOutput = new StringBuilder ();
int code = Driver.RunCommand ("mono", String.Format ("/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore {0}/packages.config", testFolder), output: restoreOutput);
if (code != 0)
Assert.Fail ("ProtobufShouldSerializeAndDeserialize failed to restore nuget packages");
TI.BuildProject (testFolder + "/Protobuf_Test.csproj", true);
TI.RunAndAssert (testFolder + "/bin/Debug/Protobuf_Test.app/Contents/MacOS/Protobuf_Test", null, "Run");
Assert.True (File.Exists (testResults));
using (TextReader reader = File.OpenText (testResults)) {
var output = reader.ReadLine ();
Assert.AreEqual ("Test Passed", output);
}
File.Delete (testResults);
}
[Test]
public void Net45ShouldUseImmutableCollection ()
{
var testFolder = "../../../../../../../common/mac/TestProjects/ImmutableCollection_Test/ImmutableCollection_Test";
StringBuilder restoreOutput = new StringBuilder ();
int code = Driver.RunCommand ("mono", String.Format ("/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore {0}/packages.config", testFolder), output: restoreOutput);
if (code != 0)
Assert.Fail ("Net45ShouldUseImmutableCollection failed to restore nuget packages");
TI.BuildProject (testFolder + "/ImmutableCollection_Test.csproj", true);
TI.RunAndAssert (testFolder + "/bin/Debug/ImmutableCollection_Test.app/Contents/MacOS/ImmutableCollection_Test", null, "Run");
}
[Test]
public void BasicPCLTest ()
{
var testFolder = "../../../../../../../common/mac/TestProjects/BasicPCLTest/BasicPCLTest";
var testResults = testFolder + "/TestResult.txt";
if (File.Exists (testResults))
File.Delete (testResults);
StringBuilder restoreOutput = new StringBuilder ();
int code = Driver.RunCommand ("mono", String.Format ("/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore {0}/../MyLibrary/packages.config", testFolder), output: restoreOutput);
if (code != 0)
Assert.Fail ("Net45ShouldUseImmutableCollection failed to restore nuget packages");
TI.BuildProject (testFolder + "/BasicPCLTest.csproj", true);
TI.RunAndAssert (testFolder + "/bin/Debug/BasicPCLTest.app/Contents/MacOS/BasicPCLTest", null, "Run");
Assert.True (File.Exists (testResults));
using (TextReader reader = File.OpenText (testResults)) {
var output = reader.ReadToEnd ();
Assert.AreEqual ("{\n \"MyArray\": [\n \"Manual text\",\n \"2000-05-23T00:00:00\"\n ]\n}\n", output);
}
File.Delete (testResults);
}
}
}

Просмотреть файл

@ -1046,6 +1046,11 @@
<Compile Include="..\EmbeddedResources\ResourcesTest.cs">
<Link>EmbeddedResources\ResourcesTest.cs</Link>
</Compile>
<Compile Include="System.ServiceModel\Net45.cs" />
<Compile Include="..\common\mac\ProjectTestHelpers.cs">
<Link>ProjectTestHelpers.cs</Link>
</Compile>
<Compile Include="Unified45.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
@ -1112,6 +1117,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="EmbeddedResources\" />
<Folder Include="System.ServiceModel\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\external\guiunit\src\framework\GuiUnit_xammac_mobile.csproj">