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.
This commit is contained in:
N. Taylor Mullen 2017-11-30 10:41:26 -08:00
parent ee3bc17559
commit b6fb9bda50
1 changed files with 0 additions and 67 deletions

View File

@ -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<ProjectExtensibilityConfiguration>();
TagHelpersCompletionSource = new TaskCompletionSource<TagHelperResolutionResult>();
ConfigurationFactory = Mock.Of<ProjectExtensibilityConfigurationFactory>(f => f.GetConfigurationAsync(It.IsAny<Project>(), default(CancellationToken)) == ConfigurationCompletionSource.Task);
TagHelperResolver = Mock.Of<TagHelperResolver>(f => f.GetTagHelpersAsync(It.IsAny<Project>(), default(CancellationToken)) == TagHelpersCompletionSource.Task);
}
private Project Project { get; }
private ProjectExtensibilityConfigurationFactory ConfigurationFactory { get; }
private TagHelperResolver TagHelperResolver { get; }
private TaskCompletionSource<ProjectExtensibilityConfiguration> ConfigurationCompletionSource { get; }
private TaskCompletionSource<TagHelperResolutionResult> 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<ProjectExtensibilityConfiguration>();
var tagHelpers = Array.Empty<TagHelperDescriptor>();
var tagHelperResolutionResult = new TagHelperResolutionResult(tagHelpers, Array.Empty<RazorDiagnostic>());
// 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);
}
}
}