mirror of
https://github.com/qmlnet/qmlnet.git
synced 2026-05-21 06:45:32 -06:00
Qml tests: converted AwaitTests
This commit is contained in:
parent
1ad32d219f
commit
6fcda93952
1 changed files with 24 additions and 42 deletions
|
|
@ -43,20 +43,14 @@ namespace Qml.Net.Tests.Qml
|
|||
Mock.Setup(x => x.TestAsync()).Returns(Task.CompletedTask);
|
||||
Mock.Setup(x => x.TestMethod());
|
||||
|
||||
NetTestHelper.RunQml(qmlApplicationEngine,
|
||||
RunQmlTest(
|
||||
"test",
|
||||
@"
|
||||
import QtQuick 2.0
|
||||
import tests 1.0
|
||||
AwaitTestsQml {
|
||||
id: test
|
||||
Component.onCompleted: function() {
|
||||
var task = test.testAsync()
|
||||
Net.await(task, function() {
|
||||
test.testMethod()
|
||||
})
|
||||
}
|
||||
}
|
||||
");
|
||||
var task = test.testAsync()
|
||||
Net.await(task, function() {
|
||||
test.testMethod()
|
||||
})
|
||||
");
|
||||
|
||||
Mock.Verify(x => x.TestMethod(), Times.Once);
|
||||
}
|
||||
|
|
@ -77,20 +71,14 @@ namespace Qml.Net.Tests.Qml
|
|||
Mock.Setup(x => x.TestAsync()).Returns(Task.FromResult("testt"));
|
||||
Mock.Setup(x => x.TestMethodWithArg("testt"));
|
||||
|
||||
NetTestHelper.RunQml(qmlApplicationEngine,
|
||||
RunQmlTest(
|
||||
"test",
|
||||
@"
|
||||
import QtQuick 2.0
|
||||
import tests 1.0
|
||||
AwaitTestsQml {
|
||||
id: test
|
||||
Component.onCompleted: function() {
|
||||
var task = test.testAsync()
|
||||
Net.await(task, function(result) {
|
||||
test.testMethodWithArg(result)
|
||||
})
|
||||
}
|
||||
}
|
||||
");
|
||||
var task = test.testAsync()
|
||||
Net.await(task, function(result) {
|
||||
test.testMethodWithArg(result)
|
||||
})
|
||||
");
|
||||
|
||||
Mock.Verify(x => x.TestMethodWithArg("testt"), Times.Once);
|
||||
}
|
||||
|
|
@ -112,23 +100,17 @@ namespace Qml.Net.Tests.Qml
|
|||
Mock.Setup(x => x.TestMethodWithArg("throw this"));
|
||||
Mock.Setup(x => x.TestMethodWithArg("success"));
|
||||
|
||||
NetTestHelper.RunQml(qmlApplicationEngine,
|
||||
RunQmlTest(
|
||||
"test",
|
||||
@"
|
||||
import QtQuick 2.0
|
||||
import tests 1.0
|
||||
AwaitTestsQml {
|
||||
id: test
|
||||
Component.onCompleted: function() {
|
||||
var task = test.testAsync('throw this')
|
||||
Net.await(task, function(result) {
|
||||
test.testMethodWithArg('success')
|
||||
},
|
||||
function(ex) {
|
||||
test.testMethodWithArg(ex.message)
|
||||
})
|
||||
}
|
||||
}
|
||||
");
|
||||
var task = test.testAsync('throw this')
|
||||
Net.await(task, function(result) {
|
||||
test.testMethodWithArg('success')
|
||||
},
|
||||
function(ex) {
|
||||
test.testMethodWithArg(ex.message)
|
||||
})
|
||||
");
|
||||
|
||||
Mock.Verify(x => x.TestMethodWithArg("throw this"), Times.Once);
|
||||
Mock.Verify(x => x.TestMethodWithArg("success"), Times.Never);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue