зеркало из
1
0
Форкнуть 0
This commit is contained in:
Terje Sandstrøm 2020-10-21 20:44:00 +02:00
Родитель eab0cf1078
Коммит 602cc6682b
19 изменённых файлов: 62 добавлений и 112 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -411,3 +411,4 @@ healthchecksdb
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
/dupl.xml

Просмотреть файл

@ -67,38 +67,36 @@ namespace NUnit.VisualStudio.TestAdapter.Tests.Acceptance.WorkspaceTools
private static void WriteNuGetConfig(string directory, string testNupkgDirectory, string packageCachePath)
{
using (var file = File.CreateText(Path.Combine(directory, "nuget.config")))
using (var writer = XmlWriter.Create(file, new XmlWriterSettings { Indent = true }))
{
writer.WriteComment(string.Join(
Environment.NewLine,
"",
"This file exists so that if any of the projects under this folder are opened by an IDE or restored from the CLI by acceptance tests or by hand,",
" 1. the .nupkg that is being tested can be referenced by these projects, and",
" 2. the .nupkg that is tested does not pollute the global cache in %userprofile%\\.nuget.",
""));
using var file = File.CreateText(Path.Combine(directory, "nuget.config"));
using var writer = XmlWriter.Create(file, new XmlWriterSettings { Indent = true });
writer.WriteComment(string.Join(
Environment.NewLine,
"",
"This file exists so that if any of the projects under this folder are opened by an IDE or restored from the CLI by acceptance tests or by hand,",
" 1. the .nupkg that is being tested can be referenced by these projects, and",
" 2. the .nupkg that is tested does not pollute the global cache in %userprofile%\\.nuget.",
""));
writer.WriteStartElement("configuration");
writer.WriteStartElement("config");
writer.WriteStartElement("configuration");
writer.WriteStartElement("config");
writer.WriteComment(" Implements the second point ");
writer.WriteStartElement("add");
writer.WriteAttributeString("key", "globalPackagesFolder");
writer.WriteAttributeString("value", packageCachePath);
writer.WriteEndElement();
writer.WriteComment(" Implements the second point ");
writer.WriteStartElement("add");
writer.WriteAttributeString("key", "globalPackagesFolder");
writer.WriteAttributeString("value", packageCachePath);
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteStartElement("packageSources");
writer.WriteEndElement();
writer.WriteStartElement("packageSources");
writer.WriteComment(" Implements the first point ");
writer.WriteStartElement("add");
writer.WriteAttributeString("key", "Build script package output");
writer.WriteAttributeString("value", testNupkgDirectory);
writer.WriteEndElement();
writer.WriteComment(" Implements the first point ");
writer.WriteStartElement("add");
writer.WriteAttributeString("key", "Build script package output");
writer.WriteAttributeString("value", testNupkgDirectory);
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteEndElement();
}
}
}

Просмотреть файл

@ -74,7 +74,7 @@ namespace NUnit.VisualStudio.TestAdapter
/// <summary>
/// Unsure about purpose of this, see https://github.com/nunit/nunit3-vs-adapter/pull/763#discussion_r446668680.
/// </summary
/// </summary>
public int LastNodeListCount { get; private set; }
public IEnumerable<string> ProcessTestCaseProperties(INUnitTestCasePropertyInfo testNode, bool addToCache, string key = null,

Просмотреть файл

@ -124,7 +124,7 @@ namespace NUnit.VisualStudio.TestAdapter.Dump
public void DumpVSInput(IEnumerable<TestCase> testCases)
{
AddString($"<VS_Input_TestCases> (DisplayName : FQN : Id)\n");
AddString("<VS_Input_TestCases> (DisplayName : FQN : Id)\n");
foreach (var tc in testCases)
{
AddString($" {tc.DisplayName} : {tc.FullyQualifiedName} : {tc.Id}\n");

Просмотреть файл

@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using System.Diagnostics;
namespace NUnit.VisualStudio.TestAdapter.Internal
{

Просмотреть файл

@ -22,7 +22,6 @@
// ***********************************************************************
using System;
using System.Reflection;
using NUnit.VisualStudio.TestAdapter.Internal;
namespace NUnit.VisualStudio.TestAdapter.Metadata

Просмотреть файл

@ -24,7 +24,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Xml;
using System.Xml.Linq;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
@ -208,12 +207,12 @@ namespace NUnit.VisualStudio.TestAdapter.NUnitEngine
ExtractParameterizedMethodsAndTheories(tf, child);
break;
case "GenericFixture":
var gtf = ExtractGenericTestFixture(parent, child, className);
var gtf = ExtractGenericTestFixture(parent, child);
parent.AddTestGenericFixture(gtf);
ExtractTestFixtures(gtf, child);
break;
case "ParameterizedFixture":
var ptf = ExtractParameterizedTestFixture(parent, child, className);
var ptf = ExtractParameterizedTestFixture(parent, child);
parent.AddParameterizedFixture(ptf);
ExtractTestFixtures(ptf, child);
break;
@ -232,7 +231,6 @@ namespace NUnit.VisualStudio.TestAdapter.NUnitEngine
throw new DiscoveryException($"Invalid type found in ExtractAllFixtures for test suite: {type}");
}
}
}
private static void ExtractTestFixtures(NUnitDiscoveryCanHaveTestFixture parent, XElement node)
@ -336,7 +334,7 @@ namespace NUnit.VisualStudio.TestAdapter.NUnitEngine
private static NUnitDiscoveryGenericFixture ExtractGenericTestFixture(
NUnitDiscoveryCanHaveTestFixture parent,
XElement node, string className)
XElement node)
{
var b = ExtractSuiteBasePropertiesClass(node);
var ts = new NUnitDiscoveryGenericFixture(b, parent);
@ -351,7 +349,7 @@ namespace NUnit.VisualStudio.TestAdapter.NUnitEngine
return ts;
}
private static NUnitDiscoveryParameterizedTestFixture ExtractParameterizedTestFixture(
NUnitDiscoveryCanHaveTestFixture parent, XElement node, string className)
NUnitDiscoveryCanHaveTestFixture parent, XElement node)
{
var b = ExtractSuiteBasePropertiesClass(node);
var ts = new NUnitDiscoveryParameterizedTestFixture(b, parent);
@ -360,11 +358,11 @@ namespace NUnit.VisualStudio.TestAdapter.NUnitEngine
private NUnitDiscoveryTestAssembly ExtractTestAssembly(XElement node, NUnitDiscoveryTestRun parent)
{
string d_type = node.Attribute(NUnitXmlAttributeNames.Type).Value;
if (d_type != "Assembly")
string dType = node.Attribute(NUnitXmlAttributeNames.Type).Value;
if (dType != "Assembly")
throw new DiscoveryException("Node is not of type assembly: " + node);
var a_base = ExtractSuiteBasePropertiesClass(node);
var assembly = new NUnitDiscoveryTestAssembly(a_base, parent);
var aBase = ExtractSuiteBasePropertiesClass(node);
var assembly = new NUnitDiscoveryTestAssembly(aBase, parent);
parent.AddTestAssembly(assembly);
return assembly;
}

Просмотреть файл

@ -218,7 +218,7 @@ namespace NUnit.VisualStudio.TestAdapter.NUnitEngine
}
/// <summary>
/// Interface for common properties between event testcase and discoverytestcase
/// Interface for common properties between event testcase and discoverytestcase.
/// </summary>
public interface INUnitCommonTestCase
{

Просмотреть файл

@ -296,21 +296,12 @@ namespace NUnit.VisualStudio.TestAdapter.TestFilterConverter
/// Get the next character in the input, consuming it.
/// </summary>
/// <returns>The next char.</returns>
private char GetChar()
{
return index < input.Length ? input[index++] : EOF_CHAR;
}
private char GetChar() => index < input.Length ? input[index++] : EOF_CHAR;
/// <summary>
/// Peek ahead at the next character in input.
/// </summary>
private char NextChar
{
get
{
return index < input.Length ? input[index] : EOF_CHAR;
}
}
private char NextChar => index < input.Length ? input[index] : EOF_CHAR;
private void SkipBlanks()
{

Просмотреть файл

@ -62,7 +62,7 @@ namespace NUnit.VisualStudio.TestAdapter
public static void AddTraitsFromTestNode(this TestCase testCase, NUnitDiscoveryTestCase testNCase,
IDictionary<string, CachedTestCaseInfo> traitsCache, ITestLogger logger, IAdapterSettings adapterSettings)
{
var ancestor = testNCase.Parent as INUnitDiscoverySuiteBase;
var ancestor = testNCase.Parent;
var key = ancestor?.Id;
var categoryList = new CategoryList(testCase, adapterSettings);
// Reading ancestor properties of a test-case node. And adding to the cache.

Просмотреть файл

@ -32,8 +32,8 @@ namespace NUnit.VisualStudio.TestAdapter
using System.Collections;
// ReSharper disable once RedundantUsingDirective
using System.Reflection; // Needed for .net core 2.1
using NUnit.VisualStudio.TestAdapter.Internal; // Needed for reflection
using NUnit.VisualStudio.TestAdapter.TestFilterConverter;
using Internal; // Needed for reflection
using TestFilterConverter;
public interface IVsTestFilter
{

Просмотреть файл

@ -22,7 +22,6 @@
// ***********************************************************************
using System;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using NUnit.Framework;
namespace NUnit.VisualStudio.TestAdapter.Tests

Просмотреть файл

@ -34,7 +34,7 @@ namespace NUnit.VisualStudio.TestAdapter.Tests
[TestCase(@"C:\Program Files (x86)\Something")]
public void ThatWeFindForbiddenFolders(string folder)
{
var sut = new TestAdapter.NUnit3TestExecutor();
var sut = new NUnit3TestExecutor();
sut.InitializeForbiddenFolders();
Assert.That(sut.CheckDirectory(folder));
}
@ -44,7 +44,7 @@ namespace NUnit.VisualStudio.TestAdapter.Tests
[TestCase(@"C:\Program Files Whatever\Something")]
public void ThatWeAcceptNonForbiddenFolders(string folder)
{
var sut = new TestAdapter.NUnit3TestExecutor();
var sut = new NUnit3TestExecutor();
sut.InitializeForbiddenFolders();
Assert.That(sut.CheckDirectory(folder), Is.False);
}
@ -52,7 +52,7 @@ namespace NUnit.VisualStudio.TestAdapter.Tests
[Test]
public void ThatForbiddenFoldersAreUnique()
{
var sut = new TestAdapter.NUnit3TestExecutor();
var sut = new NUnit3TestExecutor();
sut.InitializeForbiddenFolders();
var sutunique = sut.ForbiddenFolders.Distinct();
Assert.That(sutunique.Count(), Is.EqualTo(sut.ForbiddenFolders.Count), "There are duplicate entries in ForbiddenFolders");

Просмотреть файл

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using NUnit.Framework;
namespace NUnit.VisualStudio.TestAdapter.Tests

Просмотреть файл

@ -41,33 +41,15 @@ namespace NUnit.VisualStudio.TestAdapter.Tests.Fakes
#region IRunContext Members
bool IRunContext.InIsolation
{
get { throw new NotImplementedException(); }
}
bool IRunContext.InIsolation => throw new NotImplementedException();
bool IRunContext.IsBeingDebugged
{
get { throw new NotImplementedException(); }
}
bool IRunContext.IsBeingDebugged => throw new NotImplementedException();
bool IRunContext.IsDataCollectionEnabled
{
get { throw new NotImplementedException(); }
}
bool IRunContext.IsDataCollectionEnabled => throw new NotImplementedException();
bool IRunContext.KeepAlive
{
get
{
return true;
}
}
bool IRunContext.KeepAlive => true;
string IRunContext.TestRunDirectory
{
get { throw new NotImplementedException(); }
}
string IRunContext.TestRunDirectory => throw new NotImplementedException();
ITestCaseFilterExpression IRunContext.GetTestCaseFilter(IEnumerable<string> supportedProperties, Func<string, TestProperty> propertyProvider)
{
@ -76,9 +58,6 @@ namespace NUnit.VisualStudio.TestAdapter.Tests.Fakes
#endregion
public string SolutionDirectory
{
get { throw new NotImplementedException(); }
}
public string SolutionDirectory => throw new NotImplementedException();
}
}

Просмотреть файл

@ -1073,7 +1073,6 @@ namespace NUnit.VisualStudio.TestAdapter.Tests.NUnitEngineTests
</test-run>";
// [Ignore("Not ready yet, Issue 770")]
[Test]
public void ThatSetUpFixtureWorksIssue770()
{
@ -1081,8 +1080,6 @@ namespace NUnit.VisualStudio.TestAdapter.Tests.NUnitEngineTests
var ndr = sut.ConvertXml(
new NUnitResults(XmlHelper.CreateXmlNode(SetupFixtureIssue770)));
Assert.That(ndr, Is.Not.Null);
}
}
}

Просмотреть файл

@ -202,7 +202,6 @@ namespace NUnit.VisualStudio.TestAdapter.Tests
{
private ITestExecutionRecorder recorder;
private ITestConverterCommon converter;
private IDumpXml dumpxml;
private IAdapterSettings settings;
private INUnit3TestExecutor executor;
@ -230,7 +229,6 @@ namespace NUnit.VisualStudio.TestAdapter.Tests
{
recorder = Substitute.For<IFrameworkHandle>();
converter = Substitute.For<ITestConverterCommon>();
dumpxml = Substitute.For<IDumpXml>();
settings = Substitute.For<IAdapterSettings>();
executor = Substitute.For<INUnit3TestExecutor>();
executor.Settings.Returns(settings);

Просмотреть файл

@ -156,22 +156,20 @@ namespace NUnit.VisualStudio.TestAdapter.Tests
private sealed class Fixture
{
public ITestLogger Logger { get; } = Substitute.For<ITestLogger>();
private ITestLogger Logger { get; } = Substitute.For<ITestLogger>();
public IMetadataProvider MetadataProvider { get; } = Substitute.For<IMetadataProvider>();
private readonly string _existingAssemblyPath = typeof(NavigationDataProviderTests).GetTypeInfo().Assembly.Location;
private readonly string existingAssemblyPath = typeof(NavigationDataProviderTests).GetTypeInfo().Assembly.Location;
public void CauseLookupFailure()
{
using (var navigationProvider = new NavigationDataProvider(_existingAssemblyPath, Logger, MetadataProvider))
{
navigationProvider.GetNavigationData("NonExistentFixture", "SomeTest");
navigationProvider.GetNavigationData("NonExistentFixture", "SomeTest");
}
using var navigationProvider = new NavigationDataProvider(existingAssemblyPath, Logger, MetadataProvider);
navigationProvider.GetNavigationData("NonExistentFixture", "SomeTest");
navigationProvider.GetNavigationData("NonExistentFixture", "SomeTest");
}
public void AssertLoggerReceivedErrorForAssemblyPath()
{
Logger.Received().Warning(Arg.Is<string>(message => message.Contains(_existingAssemblyPath)), Arg.Any<Exception>());
Logger.Received().Warning(Arg.Is<string>(message => message.Contains(existingAssemblyPath)), Arg.Any<Exception>());
}
}
}

Просмотреть файл

@ -537,13 +537,11 @@ namespace NUnit.VisualStudio.TestAdapter.Tests
{
var settings = Substitute.For<IAdapterSettings>();
settings.CollectSourceInformation.Returns(false);
using (var converter = new TestConverterForXml(
using var converter = new TestConverterForXml(
new TestLogger(new MessageLoggerStub()),
"unused",
settings))
{
return converter.ConvertTestCases(xml);
}
settings);
return converter.ConvertTestCases(xml);
}
[Test]