Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@xamarin.com>2019-07-26 16:41:32 +0300
committerGitHub <noreply@github.com>2019-07-26 16:41:32 +0300
commitbb2a58a2ce0c343ebc84a473701c78a60f045864 (patch)
tree39470d5f6a1d9810b1d109ed215b8dd9552bc109 /main
parent96d2acd8edf88ee9d95f98cfaeb78a34105ceb11 (diff)
parent9e025082074c86c2160cc57dddfff10e43bb7d71 (diff)
Merge pull request #8227 from mono/backport-pr-8119-to-release-8.2
[release-8.2] [BuildOutput] Simplifies and removes delay cancellation in SearchCanBeCanceled test
Diffstat (limited to 'main')
-rw-r--r--main/tests/Ide.Tests/MonoDevelop.Ide/BuildOutputTests.cs23
1 files changed, 20 insertions, 3 deletions
diff --git a/main/tests/Ide.Tests/MonoDevelop.Ide/BuildOutputTests.cs b/main/tests/Ide.Tests/MonoDevelop.Ide/BuildOutputTests.cs
index a1ce9ac7e1..9b01d0495b 100644
--- a/main/tests/Ide.Tests/MonoDevelop.Ide/BuildOutputTests.cs
+++ b/main/tests/Ide.Tests/MonoDevelop.Ide/BuildOutputTests.cs
@@ -132,7 +132,7 @@ namespace MonoDevelop.Ide
}
[Test]
- public async Task CustomProject_SearchCanBeCanceled ()
+ public async Task CustomProject_StressSearchCanBeCanceled ()
{
BuildOutputNode firstMatch = null;
@@ -142,13 +142,30 @@ namespace MonoDevelop.Ide
for (int i = 0; i < 100; i++) {
await Task.WhenAll (Task.Run (async () => firstMatch = await search.FirstMatch ("Message ")),
Task.Delay (100).ContinueWith (t => search.Cancel ()));
-
- Assert.Null (firstMatch, "Got a first match while search was canceled");
Assert.True (search.IsCanceled, "Search was not canceled");
}
}
[Test]
+ public async Task CustomProject_SearchCanBeCanceled ()
+ {
+ var bo = GenerateCustomBuild (10);
+ var search = new BuildOutputDataSearch (bo.GetRootNodes (true));
+
+ var searchTask = search.FirstMatch ("Message ");
+ search.Cancel ();
+
+ var firstMatch = await searchTask;
+ Assert.Null (firstMatch, "Got a first match, but the canceled search did not expect records");
+ Assert.True (search.IsCanceled, "Search was not canceled, but we expect cancel the operation");
+
+ searchTask = search.FirstMatch ("Message ");
+ firstMatch = await searchTask;
+ Assert.NotNull (firstMatch, "No record was found in the search, but one was expected to be found.");
+ Assert.False (search.IsCanceled, "Search was canceled for some unexpected reason");
+ }
+
+ [Test]
public void BuildOutputNode_Search ()
{
var result = GetTestNodes ();