From b6fb9bda5000757c6938909c5155cd582d57a3bf Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 30 Nov 2017 10:41:26 -0800 Subject: [PATCH] Remove flaky, already tested test. - This test was flaky due to the nature of what it was testing and had negative value due to the testing complexities. In the integration test pieces (running VS) this is already tested thoroughly. --- .../DefaultProjectSnapshotWorkerTest.cs | 67 ------------------- 1 file changed, 67 deletions(-) delete mode 100644 test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotWorkerTest.cs diff --git a/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotWorkerTest.cs b/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotWorkerTest.cs deleted file mode 100644 index 8434f4fbb7..0000000000 --- a/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotWorkerTest.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Moq; -using Xunit; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - public class DefaultProjectSnapshotWorkerTest : ForegroundDispatcherTestBase - { - public DefaultProjectSnapshotWorkerTest() - { - Project = new AdhocWorkspace().AddProject("Test1", LanguageNames.CSharp); - - ConfigurationCompletionSource = new TaskCompletionSource(); - TagHelpersCompletionSource = new TaskCompletionSource(); - ConfigurationFactory = Mock.Of(f => f.GetConfigurationAsync(It.IsAny(), default(CancellationToken)) == ConfigurationCompletionSource.Task); - TagHelperResolver = Mock.Of(f => f.GetTagHelpersAsync(It.IsAny(), default(CancellationToken)) == TagHelpersCompletionSource.Task); - } - - private Project Project { get; } - - private ProjectExtensibilityConfigurationFactory ConfigurationFactory { get; } - - private TagHelperResolver TagHelperResolver { get; } - - private TaskCompletionSource ConfigurationCompletionSource { get; } - - private TaskCompletionSource TagHelpersCompletionSource { get; } - - [ForegroundFact] - public async Task ProcessUpdateAsync_DoesntBlockForegroundThread() - { - // Arrange - var worker = new DefaultProjectSnapshotWorker(Dispatcher, ConfigurationFactory, TagHelperResolver); - - var context = new ProjectSnapshotUpdateContext(Project); - - var configuration = Mock.Of(); - var tagHelpers = Array.Empty(); - var tagHelperResolutionResult = new TagHelperResolutionResult(tagHelpers, Array.Empty()); - - // Act 1 -- We want to verify that this doesn't block the main thread - var task = worker.ProcessUpdateAsync(context); - - // Assert 1 - // - // We haven't let the background task proceed yet, so these are still null. - Assert.Null(context.Configuration); - Assert.Null(context.TagHelpers); - - // Act 2 - Ok let's go - ConfigurationCompletionSource.SetResult(configuration); - TagHelpersCompletionSource.SetResult(tagHelperResolutionResult); - await task; - - // Assert 2 - Assert.Same(configuration, context.Configuration); - Assert.Same(tagHelpers, context.TagHelpers); - } - } -}