This commit is contained in:
Sebastien Pouliot 2011-09-28 09:08:48 -04:00
Родитель 113e88736c
Коммит 449a262e2a
13 изменённых файлов: 1058 добавлений и 0 удалений

42
AppDelegate.cs Normal file
Просмотреть файл

@ -0,0 +1,42 @@
// AppDelegate.cs: Customize (add tests assemblies) your runner application here!
//
// Authors:
// Sebastien Pouliot <sebastien@xamarin.com>
//
// Copyright 2011 Xamarin Inc. All rights reserved
using System.Reflection;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.NUnit.UI;
namespace touchunit
{
/// <summary>
/// The UIApplicationDelegate for the application. This class is responsible for launching the
/// User Interface of the application, as well as listening (and optionally responding) to
/// application events from iOS.
/// </summary>
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate {
// class-level declarations
UIWindow window;
TouchRunner runner;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
runner = new TouchRunner (window);
// tests can be inside the main assembly
runner.Add (Assembly.GetExecutingAssembly ());
// otherwise you need to ensure that the test assemblies will
// become part of the app bundle
runner.Add (typeof (MonoTouchFixtures.RegressionTest).Assembly);
window.RootViewController = new UINavigationController (runner.GetViewController ());
window.MakeKeyAndVisible ();
return true;
}
}
}

12
Info.plist Normal file
Просмотреть файл

@ -0,0 +1,12 @@
<?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>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

21
Main.cs Normal file
Просмотреть файл

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace touchunit
{
public class Application
{
/// <summary>
/// This is the main entry point of the application.
/// </summary>
static void Main (string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main (args, null, "AppDelegate");
}
}
}

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

@ -0,0 +1,292 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}</ProjectGuid>
<ProjectTypeGuids>{E613F3A2-FE9C-494F-B74E-F63BCB86FEA6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>NUnitLite</RootNamespace>
<AssemblyName>NUnitLite</AssemblyName>
<MtouchMinimumOS>3.0</MtouchMinimumOS>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;NUNITLITE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchDebug>False</MtouchDebug>
<MtouchUseSGen>false</MtouchUseSGen>
<ConsolePause>false</ConsolePause>
<MtouchUseLlvm>false</MtouchUseLlvm>
<MtouchUseThumb>false</MtouchUseThumb>
<MtouchArch>ARMv6</MtouchArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchUseSGen>false</MtouchUseSGen>
<MtouchDebug>False</MtouchDebug>
<ConsolePause>false</ConsolePause>
<MtouchUseLlvm>false</MtouchUseLlvm>
<MtouchUseThumb>false</MtouchUseThumb>
<MtouchArch>ARMv6</MtouchArch>
<DefineConstants>NUNITLITE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\AssemblyInfo.cs">
<Link>NUnitLite\AssemblyInfo.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Env.cs">
<Link>NUnitLite\Env.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\ITest.cs">
<Link>NUnitLite\ITest.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\NullListener.cs">
<Link>NUnitLite\NullListener.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Reflect.cs">
<Link>NUnitLite\Reflect.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\TestCase.cs">
<Link>NUnitLite\TestCase.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\TestListener.cs">
<Link>NUnitLite\TestListener.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\TestResult.cs">
<Link>NUnitLite\TestResult.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\TestSuite.cs">
<Link>NUnitLite\TestSuite.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\AttributeConstraints.cs">
<Link>NUnitLite\Constraints\AttributeConstraints.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\BasicConstraints.cs">
<Link>NUnitLite\Constraints\BasicConstraints.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\BinaryOperations.cs">
<Link>NUnitLite\Constraints\BinaryOperations.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\CollectionConstraints.cs">
<Link>NUnitLite\Constraints\CollectionConstraints.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\ComparisonAdapter.cs">
<Link>NUnitLite\Constraints\ComparisonAdapter.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\ComparisonConstraints.cs">
<Link>NUnitLite\Constraints\ComparisonConstraints.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\Constraint.cs">
<Link>NUnitLite\Constraints\Constraint.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\ConstraintBuilder.cs">
<Link>NUnitLite\Constraints\ConstraintBuilder.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\ConstraintExpression.cs">
<Link>NUnitLite\Constraints\ConstraintExpression.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\ConstraintExpressionBase.cs">
<Link>NUnitLite\Constraints\ConstraintExpressionBase.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\ConstraintFactory.cs">
<Link>NUnitLite\Constraints\ConstraintFactory.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\ConstraintOperators.cs">
<Link>NUnitLite\Constraints\ConstraintOperators.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\ContainsConstraint.cs">
<Link>NUnitLite\Constraints\ContainsConstraint.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\EmptyConstraint.cs">
<Link>NUnitLite\Constraints\EmptyConstraint.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\EqualConstraint.cs">
<Link>NUnitLite\Constraints\EqualConstraint.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\EqualityAdapter.cs">
<Link>NUnitLite\Constraints\EqualityAdapter.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\FloatingPointNumerics.cs">
<Link>NUnitLite\Constraints\FloatingPointNumerics.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\IResolveConstraint.cs">
<Link>NUnitLite\Constraints\IResolveConstraint.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\MessageWriter.cs">
<Link>NUnitLite\Constraints\MessageWriter.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\MsgUtils.cs">
<Link>NUnitLite\Constraints\MsgUtils.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\NUnitComparer.cs">
<Link>NUnitLite\Constraints\NUnitComparer.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\NUnitEqualityComparer.cs">
<Link>NUnitLite\Constraints\NUnitEqualityComparer.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\Numerics.cs">
<Link>NUnitLite\Constraints\Numerics.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\PathConstraints.cs">
<Link>NUnitLite\Constraints\PathConstraints.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\PredicateConstraint.cs">
<Link>NUnitLite\Constraints\PredicateConstraint.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\PrefixConstraints.cs">
<Link>NUnitLite\Constraints\PrefixConstraints.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\PropertyConstraint.cs">
<Link>NUnitLite\Constraints\PropertyConstraint.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\RangeConstraint.cs">
<Link>NUnitLite\Constraints\RangeConstraint.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\ResolvableConstraintExpression.cs">
<Link>NUnitLite\Constraints\ResolvableConstraintExpression.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\SameAsConstraint.cs">
<Link>NUnitLite\Constraints\SameAsConstraint.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\SerializableConstraints.cs">
<Link>NUnitLite\Constraints\SerializableConstraints.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\StringConstraints.cs">
<Link>NUnitLite\Constraints\StringConstraints.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\ThrowsConstraint.cs">
<Link>NUnitLite\Constraints\ThrowsConstraint.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\Tolerance.cs">
<Link>NUnitLite\Constraints\Tolerance.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Constraints\TypeConstraints.cs">
<Link>NUnitLite\Constraints\TypeConstraints.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\Assert.cs">
<Link>NUnitLite\Framework\Assert.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\AssertionException.cs">
<Link>NUnitLite\Framework\AssertionException.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\AssertionHelper.cs">
<Link>NUnitLite\Framework\AssertionHelper.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\Contains.cs">
<Link>NUnitLite\Framework\Contains.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\DescriptionAttribute.cs">
<Link>NUnitLite\Framework\DescriptionAttribute.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\ExpectedExceptionAttribute.cs">
<Link>NUnitLite\Framework\ExpectedExceptionAttribute.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\GlobalSettings.cs">
<Link>NUnitLite\Framework\GlobalSettings.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\Has.cs">
<Link>NUnitLite\Framework\Has.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\IExpectException.cs">
<Link>NUnitLite\Framework\IExpectException.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\IgnoreAttribute.cs">
<Link>NUnitLite\Framework\IgnoreAttribute.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\IgnoreException.cs">
<Link>NUnitLite\Framework\IgnoreException.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\InconclusiveException.cs">
<Link>NUnitLite\Framework\InconclusiveException.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\Is.cs">
<Link>NUnitLite\Framework\Is.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\Iz.cs">
<Link>NUnitLite\Framework\Iz.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\NUnitLiteException.cs">
<Link>NUnitLite\Framework\NUnitLiteException.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\PropertyAttribute.cs">
<Link>NUnitLite\Framework\PropertyAttribute.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\RequiredAddinAttribute.cs">
<Link>NUnitLite\Framework\RequiredAddinAttribute.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\SetUpAttribute.cs">
<Link>NUnitLite\Framework\SetUpAttribute.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\StackFilter.cs">
<Link>NUnitLite\Framework\StackFilter.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\SuccessException.cs">
<Link>NUnitLite\Framework\SuccessException.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\TearDownAttribute.cs">
<Link>NUnitLite\Framework\TearDownAttribute.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\TestAttribute.cs">
<Link>NUnitLite\Framework\TestAttribute.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\TestFixtureAttribute.cs">
<Link>NUnitLite\Framework\TestFixtureAttribute.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\TextMessageWriter.cs">
<Link>NUnitLite\Framework\TextMessageWriter.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Framework\Throws.cs">
<Link>NUnitLite\Framework\Throws.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Runner\CommandLineOptions.cs">
<Link>NUnitLite\Runner\CommandLineOptions.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Runner\ConsoleWriter.cs">
<Link>NUnitLite\Runner\ConsoleWriter.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Runner\ResultSummary.cs">
<Link>NUnitLite\Runner\ResultSummary.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Runner\TcpWriter.cs">
<Link>NUnitLite\Runner\TcpWriter.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Runner\TestLoader.cs">
<Link>NUnitLite\Runner\TestLoader.cs</Link>
</Compile>
<Compile Include="..\..\NUnitLite\NUnitLite-0.6.0\src\NUnitLite\Runner\TestRunner.cs">
<Link>NUnitLite\Runner\TestRunner.cs</Link>
</Compile>
<Compile Include="TouchRunner\TestCaseElement.cs" />
<Compile Include="TouchRunner\TestElement.cs" />
<Compile Include="TouchRunner\TestSuiteElement.cs" />
<Compile Include="TouchRunner\TouchRunner.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="TouchRunner\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MonoTouch.Dialog\MonoTouch.Dialog\MonoTouch.Dialog.csproj">
<Project>{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}</Project>
<Name>MonoTouch.Dialog</Name>
</ProjectReference>
</ItemGroup>
</Project>

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

@ -0,0 +1,62 @@
// TestCaseElement.cs: MonoTouch.Dialog element for TestCase
//
// Authors:
// Sebastien Pouliot <sebastien@xamarin.com>
//
// Copyright 2011 Xamarin Inc. All rights reserved
using System;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using NUnitLite;
using NUnitLite.Runner;
using NUnit.Framework;
namespace MonoTouch.NUnit.UI {
class TestCaseElement : TestElement {
TimeSpan time;
public TestCaseElement (TestCase testCase, TouchRunner runner)
: base (testCase, runner)
{
Caption = testCase.Name;
Value = "NotExecuted";
this.Tapped += delegate {
Run ();
};
}
public TestCase TestCase {
get { return Test as TestCase; }
}
public void Run ()
{
DateTime start = DateTime.UtcNow;
Result = TestCase.Run (Runner);
time = (DateTime.UtcNow - start);
Update ();
}
public override void Update ()
{
Value = Result.Message;
if (Result.IsError) {
Value = Result.Message ?? "Unknown error";
DetailColor = UIColor.Red;
} else if (Result.IsFailure) {
// Value = "Failed at assertion #" + Assert.Counter;
DetailColor = UIColor.Red;
} else if (Result.IsSuccess) {
int counter = Assert.Counter;
Value = String.Format ("Success! {0} ms for {1} assertion{2}",
time.TotalMilliseconds, counter,
counter == 1 ? String.Empty : "s");
DetailColor = DarkGreen;
}
}
}
}

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

@ -0,0 +1,58 @@
// TestElement.cs: MonoTouch.Dialog element for ITest, i.e. TestSuite and TestCase
//
// Authors:
// Sebastien Pouliot <sebastien@xamarin.com>
//
// Copyright 2011 Xamarin Inc. All rights reserved
using System;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using NUnitLite;
using NUnitLite.Runner;
namespace MonoTouch.NUnit.UI {
abstract class TestElement : StyledStringElement {
static internal UIColor DarkGreen = UIColor.FromRGB (0x00, 0x77, 0x00);
private TestResult result;
public TestElement (ITest test, TouchRunner runner)
: base ("?", "?", UITableViewCellStyle.Subtitle)
{
if (test == null)
throw new ArgumentNullException ("test");
if (runner == null)
throw new ArgumentNullException ("runner");
Test = test;
Runner = runner;
}
protected TouchRunner Runner { get; private set; }
protected TestResult Result {
get { return result ?? new TestResult (Test); }
set { result = value; }
}
protected ITest Test { get; private set; }
public void Update (TestResult result)
{
Result = result;
Update ();
if (GetContainerTableView () != null) {
var root = GetImmediateRootElement ();
root.Reload (this, UITableViewRowAnimation.Fade);
}
}
abstract public void Update ();
}
}

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

@ -0,0 +1,78 @@
// TestSuiteElement.cs: MonoTouch.Dialog element for TestSuite
//
// Authors:
// Sebastien Pouliot <sebastien@xamarin.com>
//
// Copyright 2011 Xamarin Inc. All rights reserved
using System;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using NUnitLite;
using NUnitLite.Runner;
namespace MonoTouch.NUnit.UI {
class TestSuiteElement : TestElement {
TimeSpan time;
public TestSuiteElement (TestSuite test, TouchRunner runner)
: base (test, runner)
{
Caption = Suite.Name;
int count = Suite.TestCaseCount;
if (count > 0) {
Accessory = UITableViewCellAccessory.DisclosureIndicator;
DetailColor = DarkGreen;
Value = String.Format ("{0} test case{1}, {2}", count, count == 1 ? String.Empty : "s", Suite.RunState);
Tapped += delegate {
runner.Show (Suite);
};
} else {
DetailColor = UIColor.Orange;
Value = "No test found inside the assembly";
}
}
public TestSuite Suite {
get { return Test as TestSuite; }
}
public void Run ()
{
DateTime start = DateTime.UtcNow;
Result = Suite.Run (Runner);
time = (DateTime.UtcNow - start);
Update ();
}
public override void Update ()
{
int error = 0;
int failure = 0;
int success = 0;
foreach (TestResult tr in Result.Results) {
if (tr.IsError)
error++;
else if (tr.IsFailure)
failure++;
else if (tr.IsSuccess)
success++;
}
if (Result.IsSuccess) {
Value = String.Format ("Success! {0} ms for {1} test{2}",
time.TotalMilliseconds, success,
success == 1 ? String.Empty : "s");
DetailColor = DarkGreen;
} else if (Result.Executed) {
DetailColor = UIColor.Red;
Value = String.Format ("{0} success, {1} failure{2}, {3} error{4}",
success, failure, failure > 1 ? "s" : String.Empty,
error, error > 1 ? "s" : String.Empty);
}
}
}
}

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

@ -0,0 +1,160 @@
// TouchRunner.cs: MonoTouch.Dialog-based driver to run unit tests
//
// Authors:
// Sebastien Pouliot <sebastien@xamarin.com>
//
// Copyright 2011 Xamarin Inc. All rights reserved
using System;
using System.Collections.Generic;
using System.Reflection;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using NUnitLite;
using NUnitLite.Runner;
namespace MonoTouch.NUnit.UI {
public class TouchRunner : TestListener {
UIWindow window;
public TouchRunner (UIWindow window)
{
if (window == null)
throw new ArgumentNullException ("window");
this.window = window;
}
public UINavigationController NavigationController {
get { return (UINavigationController) window.RootViewController; }
}
List<TestSuite> suites = new List<TestSuite> ();
public void Add (Assembly assembly)
{
if (assembly == null)
throw new ArgumentNullException ("assembly");
// TestLoader.Load always return a TestSuite so we can avoid casting many times
suites.Add (TestLoader.Load (assembly) as TestSuite);
}
public UIViewController GetViewController ()
{
var menu = new RootElement ("Test Runner");
Section main = new Section ();
foreach (TestSuite suite in suites) {
main.Add (Setup (suite));
}
menu.Add (main);
Section options = new Section () {
new StringElement ("Run", Run),
new StringElement ("Options...", Options),
new StringElement ("Credits...", Credits)
};
menu.Add (options);
var dv = new DialogViewController (menu) {
Autorotate = true
};
return dv;
}
void Run ()
{
foreach (TestSuite ts in suites)
suite_elements [ts].Run ();
}
void Options ()
{
// send results to...
}
void Credits ()
{
// monotouch.dialog, nunitlite, xamarin
}
Dictionary<TestSuite, DialogViewController> suites_dvc = new Dictionary<TestSuite, DialogViewController> ();
Dictionary<TestSuite, TestSuiteElement> suite_elements = new Dictionary<TestSuite, TestSuiteElement> ();
Dictionary<TestCase, TestCaseElement> case_elements = new Dictionary<TestCase, TestCaseElement> ();
public void Show (TestSuite suite)
{
NavigationController.PushViewController (suites_dvc [suite], true);
}
TestSuiteElement Setup (TestSuite suite)
{
TestSuiteElement tse = new TestSuiteElement (suite, this);
suite_elements.Add (suite, tse);
var root = new RootElement ("Tests");
Section section = new Section (suite.Name);
foreach (ITest test in suite.Tests) {
TestSuite ts = (test as TestSuite);
if (ts != null) {
section.Add (Setup (ts));
} else {
TestCase tc = (test as TestCase);
if (tc != null) {
section.Add (Setup (tc));
} else {
throw new NotImplementedException (test.GetType ().ToString ());
}
}
}
root.Add (section);
if (section.Count > 1) {
Section options = new Section () {
new StringElement ("Run all", delegate () {
Run (suite);
})
};
root.Add (options);
}
suites_dvc.Add (suite, new DialogViewController (root, true));
return tse;
}
TestCaseElement Setup (TestCase test)
{
TestCaseElement tce = new TestCaseElement (test, this);
case_elements.Add (test, tce);
return tce;
}
void Run (TestSuite suite)
{
suite_elements [suite].Run ();
}
public void TestStarted (ITest test)
{
}
public void TestFinished (TestResult result)
{
TestSuite ts = result.Test as TestSuite;
if (ts != null) {
suite_elements [ts].Update (result);
} else {
TestCase tc = result.Test as TestCase;
if (tc != null)
case_elements [tc].Update (result);
}
}
}
}

100
Touch.Unit.csproj Normal file
Просмотреть файл

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{5DDFD948-5455-40EB-BD67-211EA61F6472}</ProjectGuid>
<ProjectTypeGuids>{E613F3A2-FE9C-494F-B74E-F63BCB86FEA6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>Touch.Unit</RootNamespace>
<AssemblyName>TouchUnit</AssemblyName>
<MtouchMinimumOS>3.0</MtouchMinimumOS>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;NUNITLITE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
<MtouchDebug>True</MtouchDebug>
<MtouchUseLlvm>false</MtouchUseLlvm>
<ConsolePause>false</ConsolePause>
<MtouchUseSGen>false</MtouchUseSGen>
<MtouchUseThumb>false</MtouchUseThumb>
<MtouchArch>ARMv6</MtouchArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
<MtouchDebug>False</MtouchDebug>
<MtouchUseSGen>false</MtouchUseSGen>
<ConsolePause>false</ConsolePause>
<MtouchUseLlvm>false</MtouchUseLlvm>
<MtouchUseThumb>false</MtouchUseThumb>
<MtouchArch>ARMv6</MtouchArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;NUNITLITE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchUseSGen>false</MtouchUseSGen>
<MtouchDebug>True</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
<ConsolePause>false</ConsolePause>
<MtouchUseThumb>false</MtouchUseThumb>
<MtouchArch>ARMv6</MtouchArch>
<MtouchUseLlvm>false</MtouchUseLlvm>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchUseSGen>false</MtouchUseSGen>
<MtouchDebug>False</MtouchDebug>
<MtouchUseThumb>false</MtouchUseThumb>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchArch>ARMv6</MtouchArch>
<MtouchUseLlvm>false</MtouchUseLlvm>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="AppDelegate.cs" />
<Compile Include="Main.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="NUnitLite\MonoTouch.NUnitLite.csproj">
<Project>{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}</Project>
<Name>MonoTouch.NUnitLite</Name>
</ProjectReference>
<ProjectReference Include="monotouch.tests\monotouch.tests.csproj">
<Project>{20E71273-1306-477D-964D-A7FAFE20196D}</Project>
<Name>monotouch.tests</Name>
</ProjectReference>
</ItemGroup>
</Project>

92
Touch.Unit.sln Normal file
Просмотреть файл

@ -0,0 +1,92 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Touch.Unit", "Touch.Unit.csproj", "{5DDFD948-5455-40EB-BD67-211EA61F6472}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoTouch.Dialog", "..\MonoTouch.Dialog\MonoTouch.Dialog\MonoTouch.Dialog.csproj", "{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoTouch.NUnitLite", "NUnitLite\MonoTouch.NUnitLite.csproj", "{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "monotouch.tests", "monotouch.tests\monotouch.tests.csproj", "{20E71273-1306-477D-964D-A7FAFE20196D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
AdHoc|iPhoneSimulator = AdHoc|iPhoneSimulator
AppStore|iPhoneSimulator = AppStore|iPhoneSimulator
AdHoc|iPhone = AdHoc|iPhone
AppStore|iPhone = AppStore|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{20E71273-1306-477D-964D-A7FAFE20196D}.AdHoc|iPhone.ActiveCfg = Debug|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.AdHoc|iPhone.Build.0 = Debug|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.AdHoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.AdHoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.AppStore|iPhone.Build.0 = Debug|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.Debug|iPhone.Build.0 = Debug|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.Release|iPhone.ActiveCfg = Release|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.Release|iPhone.Build.0 = Release|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{20E71273-1306-477D-964D-A7FAFE20196D}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AdHoc|iPhone.ActiveCfg = AdHoc|iPhone
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AdHoc|iPhone.Build.0 = AdHoc|iPhone
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AdHoc|iPhoneSimulator.ActiveCfg = AdHoc|iPhoneSimulator
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AdHoc|iPhoneSimulator.Build.0 = AdHoc|iPhoneSimulator
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AppStore|iPhone.Build.0 = AppStore|iPhone
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Debug|iPhone.ActiveCfg = Debug|iPhone
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Debug|iPhone.Build.0 = Debug|iPhone
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Release|iPhone.ActiveCfg = Release|iPhone
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Release|iPhone.Build.0 = Release|iPhone
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{5DDFD948-5455-40EB-BD67-211EA61F6472}.AdHoc|iPhone.ActiveCfg = Debug|iPhone
{5DDFD948-5455-40EB-BD67-211EA61F6472}.AdHoc|iPhone.Build.0 = Debug|iPhone
{5DDFD948-5455-40EB-BD67-211EA61F6472}.AdHoc|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{5DDFD948-5455-40EB-BD67-211EA61F6472}.AdHoc|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{5DDFD948-5455-40EB-BD67-211EA61F6472}.AppStore|iPhone.ActiveCfg = Debug|iPhone
{5DDFD948-5455-40EB-BD67-211EA61F6472}.AppStore|iPhone.Build.0 = Debug|iPhone
{5DDFD948-5455-40EB-BD67-211EA61F6472}.AppStore|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{5DDFD948-5455-40EB-BD67-211EA61F6472}.AppStore|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{5DDFD948-5455-40EB-BD67-211EA61F6472}.Debug|iPhone.ActiveCfg = Debug|iPhone
{5DDFD948-5455-40EB-BD67-211EA61F6472}.Debug|iPhone.Build.0 = Debug|iPhone
{5DDFD948-5455-40EB-BD67-211EA61F6472}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{5DDFD948-5455-40EB-BD67-211EA61F6472}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{5DDFD948-5455-40EB-BD67-211EA61F6472}.Release|iPhone.ActiveCfg = Release|iPhone
{5DDFD948-5455-40EB-BD67-211EA61F6472}.Release|iPhone.Build.0 = Release|iPhone
{5DDFD948-5455-40EB-BD67-211EA61F6472}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{5DDFD948-5455-40EB-BD67-211EA61F6472}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.AdHoc|iPhone.ActiveCfg = Debug|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.AdHoc|iPhone.Build.0 = Debug|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.AdHoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.AdHoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.AppStore|iPhone.Build.0 = Debug|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.Debug|iPhone.Build.0 = Debug|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.Release|iPhone.ActiveCfg = Release|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.Release|iPhone.Build.0 = Release|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Touch.Unit.csproj
EndGlobalSection
EndGlobal

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

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.Serialization;
using System.Xml;
using MonoTouch.AddressBookUI;
using MonoTouch.Foundation;
using NUnit.Framework;
namespace MonoTouchFixtures {
[TestFixture]
// we want the test to be availble if we use the linker
[Preserve (AllMembers = true)]
public class RegressionTest {
[Test]
// https://github.com/xamarin/monotouch/commit/cbefbeaea2eda820dfc7214e976edc83a55df38e
public void MonoAssembly_LinkedOut ()
{
Assembly a = Assembly.GetExecutingAssembly ();
Assert.That (a.GetType ().Name, Is.EqualTo ("MonoAssembly"), "MonoAssembly");
}
[Test]
// http://bugzilla.xamarin.com/show_bug.cgi?id=205
// https://bugzilla.novell.com/show_bug.cgi?id=688414
public void Bug205_ExposingIEnumerable ()
{
var ds = new DataContractSerializer (typeof (IEnumerable<int>));
using (var xw = XmlWriter.Create (System.IO.Stream.Null))
ds.WriteObject (xw, new int [] { 1, 2, 3 });
// the above should not throw System.Runtime.Serialization.SerializationException
}
[Test]
// issue indirectly found when trying: http://bugzilla.xamarin.com/show_bug.cgi?id=928
// similar to MonoAssembly_LinkedOut
// https://github.com/xamarin/monotouch/commit/409316f87f23723a384cb072163abd03ae7e6045
public void Bug928_MonoModule_LinkedOut ()
{
Module m = Assembly.GetExecutingAssembly ().ManifestModule;
Assert.That (m.GetType ().Name, Is.EqualTo ("MonoModule"), "MonoModule");
}
[Test]
// http://bugzilla.xamarin.com/show_bug.cgi?id=980
public void Bug980_AddressBook_NRE ()
{
ABPeoplePickerNavigationController picker = new ABPeoplePickerNavigationController ();
Assert.NotNull (picker.AddressBook); // no NRE should occur
}
}
}

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

@ -0,0 +1,25 @@
using System;
using MonoTouch.Foundation;
using MonoTouch.ObjCRuntime;
using NUnit.Framework;
namespace MonoTouchFixtures.ObjCRuntime {
[TestFixture]
[Preserve (AllMembers = true)]
public class RuntimeTest {
[Test]
public void GetNSObject_IntPtrZero ()
{
Assert.Null (Runtime.GetNSObject (IntPtr.Zero));
}
[Test]
//[ExpectedException (typeof (ArgumentNullException))]
public void RegisterAssembly_null ()
{
Runtime.RegisterAssembly (null);
}
}
}

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

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{20E71273-1306-477D-964D-A7FAFE20196D}</ProjectGuid>
<ProjectTypeGuids>{E613F3A2-FE9C-494F-B74E-F63BCB86FEA6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>monotouch.tests</RootNamespace>
<AssemblyName>monotouch.tests</AssemblyName>
<MtouchMinimumOS>3.0</MtouchMinimumOS>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
</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>
<MtouchDebug>False</MtouchDebug>
<MtouchUseSGen>false</MtouchUseSGen>
<ConsolePause>false</ConsolePause>
<MtouchUseLlvm>false</MtouchUseLlvm>
<MtouchUseThumb>false</MtouchUseThumb>
<MtouchArch>ARMv6</MtouchArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchUseSGen>false</MtouchUseSGen>
<MtouchDebug>False</MtouchDebug>
<ConsolePause>false</ConsolePause>
<MtouchUseLlvm>false</MtouchUseLlvm>
<MtouchUseThumb>false</MtouchUseThumb>
<MtouchArch>ARMv6</MtouchArch>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
<Reference Include="System.Runtime.Serialization" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\NUnitLite\MonoTouch.NUnitLite.csproj">
<Project>{9A9B24AF-1103-43D4-8EC0-9EC0155322FC}</Project>
<Name>MonoTouch.NUnitLite</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="RegressionTest.cs" />
<Compile Include="RuntimeTest.cs" />
</ItemGroup>
</Project>