Skip to content

Commit 0fb7b45

Browse files
authored
[Mono.Android-Tests] Fix empty files issue. (#9792)
Context: #9758 While enabling new tests for `Mono.Android-Tests`, git somehow ate my files and made them all empty. I fixed the ones that CI found but didn't notice the other empty files. Add the content of these files back. Verified on CI run that the 2 new tests are indeed being run and succeed.
1 parent a6b0f13 commit 0fb7b45

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Threading;
3+
using Android.OS;
4+
5+
using NUnit.Framework;
6+
7+
namespace Xamarin.Android.RuntimeTests {
8+
9+
[TestFixture]
10+
public class HandlerTest {
11+
12+
[Test]
13+
public void RemoveDisposedInstance ()
14+
{
15+
using (var t = new HandlerThread ("RemoveDisposedInstance")) {
16+
t.Start ();
17+
using (var h = new Handler (t.Looper)) {
18+
var e = new ManualResetEvent (false);
19+
Java.Lang.Runnable r = null;
20+
r = new Java.Lang.Runnable (() => {
21+
e.Set ();
22+
r.Dispose ();
23+
});
24+
h.Post (r.Run);
25+
e.WaitOne ();
26+
}
27+
28+
t.QuitSafely ();
29+
}
30+
}
31+
}
32+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System.Globalization;
2+
using System.Threading;
3+
using NUnit.Framework;
4+
5+
namespace Xamarin.Android.RuntimeTests
6+
{
7+
[TestFixture]
8+
public class LocalizationTests
9+
{
10+
// https://bugzilla.xamarin.com/show_bug.cgi?id=31705
11+
[Test]
12+
public void EmbeddedResources_ShouldBeLocalized ()
13+
{
14+
CultureInfo culture = Thread.CurrentThread.CurrentCulture;
15+
CultureInfo uiCulture = Thread.CurrentThread.CurrentUICulture;
16+
17+
Assert.AreEqual ("a", AppResources.String1, "Embedded string resource did not contain expected value.");
18+
19+
Thread.CurrentThread.CurrentCulture = new CultureInfo ("it-IT");
20+
Thread.CurrentThread.CurrentUICulture = new CultureInfo ("it-IT");
21+
22+
Assert.AreEqual ("b", AppResources.String1,
23+
"Embedded string resource did not contain expected value after changing CultureInfo.");
24+
25+
Thread.CurrentThread.CurrentCulture = culture;
26+
Thread.CurrentThread.CurrentUICulture = uiCulture;
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)