Skip to content

Commit 69256d8

Browse files
committed
[Xamarin.Android.NUnitLite] Import from monodroid/ae417a99
Xamarin.Android.NUnitLite is a copy of NunitLite, modified for use with Xamarin.Android and to provide a Xamarin.Android GUI.
1 parent 54ef952 commit 69256d8

File tree

284 files changed

+39182
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

284 files changed

+39182
-0
lines changed

Xamarin.Android.sln

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "monodroid", "src\monodroid\
5353
EndProject
5454
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "api-xml-adjuster", "tools\api-xml-adjuster\api-xml-adjuster.csproj", "{8A6CB07C-E493-4A4F-AB94-038645A27118}"
5555
EndProject
56+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.NUnitLite", "src\Xamarin.Android.NUnitLite\Xamarin.Android.NUnitLite.csproj", "{4D603AA3-3BFD-43C8-8050-0CD6C2601126}"
57+
EndProject
5658
Global
5759
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5860
Debug|AnyCPU = Debug|AnyCPU
@@ -194,6 +196,18 @@ Global
194196
{E8492EFB-D14A-4F32-AA28-88848322ECEA}.XAIntegrationDebug|Any CPU.Build.0 = Debug|Any CPU
195197
{E8492EFB-D14A-4F32-AA28-88848322ECEA}.XAIntegrationRelease|Any CPU.ActiveCfg = Debug|Any CPU
196198
{E8492EFB-D14A-4F32-AA28-88848322ECEA}.XAIntegrationRelease|Any CPU.Build.0 = Debug|Any CPU
199+
{4D603AA3-3BFD-43C8-8050-0CD6C2601126}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
200+
{4D603AA3-3BFD-43C8-8050-0CD6C2601126}.Debug|AnyCPU.Build.0 = Debug|Any CPU
201+
{4D603AA3-3BFD-43C8-8050-0CD6C2601126}.Release|AnyCPU.ActiveCfg = Release|Any CPU
202+
{4D603AA3-3BFD-43C8-8050-0CD6C2601126}.Release|AnyCPU.Build.0 = Release|Any CPU
203+
{4D603AA3-3BFD-43C8-8050-0CD6C2601126}.XAIntegrationDebug|Any CPU.ActiveCfg = Debug|Any CPU
204+
{4D603AA3-3BFD-43C8-8050-0CD6C2601126}.XAIntegrationDebug|Any CPU.Build.0 = Debug|Any CPU
205+
{4D603AA3-3BFD-43C8-8050-0CD6C2601126}.XAIntegrationRelease|Any CPU.ActiveCfg = Debug|Any CPU
206+
{4D603AA3-3BFD-43C8-8050-0CD6C2601126}.XAIntegrationRelease|Any CPU.Build.0 = Debug|Any CPU
207+
{4D603AA3-3BFD-43C8-8050-0CD6C2601126}.XAIntegrationDebug|AnyCPU.ActiveCfg = Debug|Any CPU
208+
{4D603AA3-3BFD-43C8-8050-0CD6C2601126}.XAIntegrationDebug|AnyCPU.Build.0 = Debug|Any CPU
209+
{4D603AA3-3BFD-43C8-8050-0CD6C2601126}.XAIntegrationRelease|AnyCPU.ActiveCfg = Debug|Any CPU
210+
{4D603AA3-3BFD-43C8-8050-0CD6C2601126}.XAIntegrationRelease|AnyCPU.Build.0 = Debug|Any CPU
197211
EndGlobalSection
198212
GlobalSection(NestedProjects) = preSolution
199213
{8FF78EB6-6FC8-46A7-8A15-EBBA9045C5FA} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62}
@@ -219,6 +233,7 @@ Global
219233
{D48EE8D0-0A0A-4493-AEF5-DAF5F8CF86AD} = {864062D3-A415-4A6F-9324-5820237BA058}
220234
{53EE4C57-1C03-405A-8243-8DA539546C88} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
221235
{8A6CB07C-E493-4A4F-AB94-038645A27118} = {864062D3-A415-4A6F-9324-5820237BA058}
236+
{4D603AA3-3BFD-43C8-8050-0CD6C2601126} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
222237
EndGlobalSection
223238
GlobalSection(MonoDevelopProperties) = preSolution
224239
Policies = $0
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
//
2+
// Copyright 2011-2012 Xamarin Inc.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
17+
using System;
18+
19+
using Android.App;
20+
using Android.Content;
21+
using Android.Content.PM;
22+
using Android.OS;
23+
using Android.Views;
24+
using Android.Widget;
25+
26+
namespace Xamarin.Android.NUnitLite {
27+
28+
[Activity (Label = "Options", WindowSoftInputMode = SoftInput.AdjustPan,
29+
ConfigurationChanges = ConfigChanges.KeyboardHidden | ConfigChanges.Orientation)]
30+
internal class OptionsActivity : Activity {
31+
CheckBox remote;
32+
TextView host_name;
33+
TextView host_port;
34+
35+
protected override void OnCreate (Bundle bundle)
36+
{
37+
base.OnCreate (bundle);
38+
SetContentView (Resource.Layout.options);
39+
40+
Options options = AndroidRunner.Runner.Options;
41+
remote = FindViewById<CheckBox> (Resource.Id.OptionRemoteServer);
42+
remote.Checked = options.EnableNetwork;
43+
host_name = FindViewById<EditText> (Resource.Id.OptionHostName);
44+
host_name.Text = options.HostName;
45+
host_port = FindViewById<EditText> (Resource.Id.OptionPort);
46+
host_port.Text = options.HostPort.ToString ();
47+
48+
base.OnCreate (bundle);
49+
}
50+
51+
int GetPort ()
52+
{
53+
int port;
54+
ushort p;
55+
if (UInt16.TryParse (host_port.Text, out p))
56+
port = p;
57+
else
58+
port = -1;
59+
return port;
60+
}
61+
62+
protected override void OnPause ()
63+
{
64+
Options options = AndroidRunner.Runner.Options;
65+
options.EnableNetwork = remote.Checked;
66+
options.HostName = host_name.Text;
67+
options.HostPort = GetPort ();
68+
options.Save (this);
69+
base.OnPause ();
70+
}
71+
}
72+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
7+
using Android.App;
8+
using Android.Content;
9+
using Android.OS;
10+
using Android.Runtime;
11+
using Android.Views;
12+
using Android.Widget;
13+
using Android.Text.Method;
14+
using NUnit.Framework.Internal;
15+
using NUnitTest = NUnit.Framework.Internal.Test;
16+
17+
namespace Xamarin.Android.NUnitLite
18+
{
19+
[Activity (Label = "Test Result")]
20+
internal class TestResultActivity : Activity
21+
{
22+
protected override void OnCreate (Bundle bundle)
23+
{
24+
base.OnCreate (bundle);
25+
26+
// Create your application here
27+
SetContentView (Resource.Layout.test_result);
28+
29+
var testName = this.Intent.GetStringExtra ("test");
30+
var parentSuiteName = testName.Substring (0, testName.LastIndexOf ('.'));
31+
32+
FindViewById<TextView> (Resource.Id.ResultRunSingleMethodTest).Click += delegate {
33+
AndroidRunner.Runner.Run ((NUnitTest) AndroidRunner.Suites [parentSuiteName].Tests.First (t => t.FullName == testName), this);
34+
UpdateData (AndroidRunner.Results [testName]);
35+
};
36+
if (AndroidRunner.Results.ContainsKey (testName))
37+
UpdateData (AndroidRunner.Results [testName]);
38+
else
39+
FindViewById<TextView> (Resource.Id.ResultFullName).Text = testName;
40+
}
41+
42+
void UpdateData (TestResult test)
43+
{
44+
if (test == null)
45+
return; // no result to fill
46+
FindViewById<TextView> (Resource.Id.ResultFullName).Text = test.FullName;
47+
FindViewById<TextView> (Resource.Id.ResultResultState).Text = test.ResultState.ToString ();
48+
FindViewById<TextView> (Resource.Id.ResultMessage).Text= test.Message;
49+
FindViewById<TextView> (Resource.Id.ResultStackTrace).Text = test.StackTrace;
50+
FindViewById<TextView> (Resource.Id.ResultStackTrace).MovementMethod = new ScrollingMovementMethod ();
51+
}
52+
}
53+
}
54+

0 commit comments

Comments
 (0)