提交 37bffe57 编写于 作者: D Dustin Campbell

Removed duplicated test helper

上级 61f30037
......@@ -225,25 +225,6 @@ protected static string GetParentDirOfParentDirOfContainingDir(string fileName)
return Directory.GetParent(parentOfContainingDir).FullName;
}
protected static void AssertThrows<TException>(Action action, Action<TException> checker = null)
where TException : Exception
{
try
{
action();
}
catch (Exception e)
{
if (e is AggregateException agg && agg.InnerExceptions.Count == 1)
{
e = agg.InnerExceptions[0];
}
Assert.Equal(typeof(TException), e.GetType());
checker?.Invoke((TException)e);
}
}
protected int GetMethodInsertionPoint(VB.Syntax.ClassBlockSyntax cb)
{
if (cb.Implements.Count > 0)
......
......@@ -19,7 +19,6 @@
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
using Xunit.Abstractions;
using static Microsoft.CodeAnalysis.MSBuild.UnitTests.SolutionGeneration;
using CS = Microsoft.CodeAnalysis.CSharp;
using VB = Microsoft.CodeAnalysis.VisualBasic;
......@@ -2887,7 +2886,7 @@ public void TestOpenProject_WithProjectFileLocked()
var projectFile = GetSolutionFileName(@"CSharpProject\CSharpProject.csproj");
using (File.Open(projectFile, FileMode.Open, FileAccess.ReadWrite))
{
AssertThrows<IOException>(() =>
AssertEx.Throws<IOException>(() =>
{
using (var workspace = CreateMSBuildWorkspace())
{
......@@ -2904,7 +2903,7 @@ public void TestOpenProject_WithNonExistentProjectFile()
// open for read-write so no-one else can read
var projectFile = GetSolutionFileName(@"CSharpProject\NoProject.csproj");
AssertThrows<FileNotFoundException>(() =>
AssertEx.Throws<FileNotFoundException>(() =>
{
using (var workspace = CreateMSBuildWorkspace())
{
......@@ -2920,7 +2919,7 @@ public void TestOpenSolution_WithNonExistentSolutionFile()
// open for read-write so no-one else can read
var solutionFile = GetSolutionFileName(@"NoSolution.sln");
AssertThrows<System.IO.FileNotFoundException>(() =>
AssertEx.Throws<FileNotFoundException>(() =>
{
using (var workspace = CreateMSBuildWorkspace())
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册