Last active
June 2, 2016 17:24
-
-
Save ChaseFlorell/5a3a627e3f0a688fe61476785a7b7232 to your computer and use it in GitHub Desktop.
Fugly back doors for Xamarin Forms + UITest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.Invoke("Backdoor", "MyActualMethod") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Activity(Label = "my.activity", | |
MainLauncher = true, | |
ScreenOrientation = ScreenOrientation.Portrait)] | |
public sealed class MainActivity : Activity | |
{ | |
public MainActivity() | |
{ | |
Backdoors = new Dictionary<string, Func<string>>(); | |
} | |
public static Dictionary<string, Func<string>> Backdoors { get; internal set; } | |
[Export("Backdoor")] | |
public string Backdoor(string actualMethod) | |
{ | |
return Backdoors[actualMethod].Invoke(); | |
} | |
protected override void OnCreate(Bundle savedInstanceState) | |
{ | |
base.OnCreate(savedInstanceState); | |
// bla | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyCustomRenderer : SomeRenderer{ | |
public MyCustomRenderer(){ | |
MainActivity.Backdoors.Add("MyActualMethod", MyActualMethod); | |
} | |
public string MyActualMethod(){ | |
return "foo bar"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment