0
我使用Xamarin Forms创建了Android应用程序。我使用Xamarin UI Test来测试生命周期应用程序。我需要应用程序的事件 - OnStart,OnSleep,OnResume。我的算法: 1.开始测试,检查UI(OnStart)。 2.应用程序进入后台(OnSleep)。为此,我用这个代码:Xamarin UI测试 - 测试生命周期应用程序(返回到应用程序)
在活动
[Export("GoOut")]
public void GoOut()
{
var uri = Uri.Parse("http://www.google.ru");
var intent = new Intent(Intent.ActionView, uri);
StartActivity(intent);
}
在测试
app.Invoke("GoOut");
的IT工作。现在我需要回到应用程序。我想触发事件OnResume并测试我的应用程序。怎么做?
我尝试这样做:
app.Invoke("GoOut");
app.Back();
这
//in Activity
[Export("Back")]
public void Back()
{
this.OnBackPressed();
}
//in my test
app.Invoke("GoOut");
app.Invoke("Back");
但它不是me.how工作,我可以回到浏览器从应用?