-
Notifications
You must be signed in to change notification settings - Fork 257
/
CompilationManagerTest.cs
25 lines (23 loc) · 1.02 KB
/
CompilationManagerTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.Dafny.LanguageServer.Language;
using Microsoft.Dafny.LanguageServer.Workspace;
using Microsoft.Extensions.Logging;
using Moq;
using Xunit;
namespace Microsoft.Dafny.LanguageServer.IntegrationTest.Unit;
public class CompilationManagerTest {
[Fact]
public async Task CancelUnstartedCompilationLeadsToCancelledTasks() {
var dafnyOptions = DafnyOptions.Create(TextWriter.Null, TextReader.Null);
var compilationManager = new CompilationManager(new Mock<ILogger<CompilationManager>>().Object,
new Mock<ITextDocumentLoader>().Object,
new Mock<IProgramVerifier>().Object,
new Mock<IGutterIconAndHoverVerificationDetailsManager>().Object,
dafnyOptions,
null, new Compilation(dafnyOptions, 0, new DafnyProject() { Uri = new Uri(Directory.GetCurrentDirectory()) }, new Uri[] { }), null);
compilationManager.CancelPendingUpdates();
await Assert.ThrowsAsync<TaskCanceledException>(() => compilationManager.ParsedCompilation);
}
}