10000 Ensure we only reference System.Net.Http v4.0.0.0 by jcansdale · Pull Request #2191 · github/VisualStudio · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Ensure we only reference System.Net.Http v4.0.0.0 #2191

Merged
merged 4 commits into from
Jan 23, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make GitHubAssemblyTests work with NCrunch
  • Loading branch information
jcansdale committed Jan 22, 2019
commit cbb48e0f92121d0d2058d52182838067489701f8
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<ItemGroup>
<PackageReference Include="Codecov" Version="1.1.0" />
<PackageReference Include="Madskristensen.VisualStudio.SDK" Version="14.3.75-pre" />
<PackageReference Include="NCrunch.Framework" Version="3.17.0" />
<PackageReference Include="NSubstitute" Version="2.0.3" />
<PackageReference Include="NUnit" version="3.9.0" />
<PackageReference Include="OpenCover" Version="4.6.519" />
Expand Down
19 changes: 17 additions & 2 deletions test/GitHub.VisualStudio.UnitTests/GitHubAssemblyTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using NCrunch.Framework;
using NUnit.Framework;

public class GitHubAssemblyTests
Expand Down Expand Up @@ -30,7 +32,20 @@ public void GitHub_Assembly_Should_Not_Reference_System_Net_Http_Above_4_0(strin
}

[DatapointSource]
string[] GitHubAssemblies => Directory.GetFiles(AssemblyDirectory, "GitHub.*.dll");
string[] GetGitHubAssemblies()
{
var prefix = "GitHub.";
if (NCrunchEnvironment.NCrunchIsResident())
{
return NCrunchEnvironment.GetAllAssemblyLocations()
.Where(p => Path.GetFileName(p).StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
.ToArray();
}
else
{
var dir = Path.GetDirectoryName(GetType().Assembly.Location);
return Directory.GetFiles(dir, $"{prefix}*.dll");
}
}

string AssemblyDirectory => Path.GetDirectoryName(GetType().Assembly.Location);
}
0