Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: remove duplicate protocol tests #2847

Merged
merged 1 commit into from
May 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -560,10 +559,8 @@ private static bool AddDownloadDependencyIfNotExist(PackageSpec spec, NuGetFrame
return false;
}


private static bool AddDependencyIfNotExist(PackageSpec spec, LibraryDependency dependency)
{

foreach (var framework in spec.TargetFrameworks.Select(e => e.FrameworkName))
{
AddDependencyIfNotExist(spec, framework, dependency);
Expand Down Expand Up @@ -633,16 +630,15 @@ private static void AddPackageDownloads(PackageSpec spec, IEnumerable<IMSBuildIt
{
foreach (var item in GetItemByType(items, "DownloadDependency"))
{

var id = item.GetProperty("Id");
var versionRange = GetVersionRange(item);
if(!(versionRange.HasLowerAndUpperBounds && versionRange.MinVersion.Equals(versionRange.MaxVersion)))

if (!(versionRange.HasLowerAndUpperBounds && versionRange.MinVersion.Equals(versionRange.MaxVersion)))
{
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.Error_PackageDownload_OnlyExactVersionsAreAllowed, versionRange.OriginalString));
}

var downloadDependency = new DownloadDependency(id, versionRange);

var frameworks = GetFrameworks(item);

foreach (var framework in frameworks)
Expand Down Expand Up @@ -881,25 +877,6 @@ private static bool IsPropertyTrue(IMSBuildItem item, string propertyName)
return StringComparer.OrdinalIgnoreCase.Equals(item.GetProperty(propertyName), bool.TrueString);
}

private static readonly Lazy<bool> _isPersistDGSet = new Lazy<bool>(() => IsPersistDGSet());

/// <summary>
/// True if NUGET_PERSIST_DG is set to true.
/// </summary>
private static bool IsPersistDGSet()
{
var settingValue = Environment.GetEnvironmentVariable("NUGET_PERSIST_DG");

bool val;
if (!string.IsNullOrEmpty(settingValue)
&& bool.TryParse(settingValue, out val))
{
return val;
}

return false;
}

/// <summary>
/// Function used to display errors and warnings at the end of restore operation.
/// The errors and warnings are read from the assets file based on restore result.
Expand All @@ -908,7 +885,7 @@ private static bool IsPersistDGSet()
/// <param name="logger">Logger used to display warnings and errors.</param>
public static Task ReplayWarningsAndErrorsAsync(LockFile lockFile, ILogger logger)
{
var logMessages = lockFile?.LogMessages?.Select(m => m.AsRestoreLogMessage()) ??
var logMessages = lockFile?.LogMessages?.Select(m => m.AsRestoreLogMessage()) ??
Enumerable.Empty<RestoreLogMessage>();

return logger.LogMessagesAsync(logMessages);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,6 @@ private static IEnumerable<string> ValidVersions()
yield return "1.0.0";
yield return "0.0.1";
yield return "1.0.0-BETA";
yield return "1.0.0";
yield return "1.0";
yield return "1.0.0.0";
yield return "1.0.1";
Expand Down Expand Up @@ -1260,4 +1259,4 @@ public void LocalFolderUtility_IsPossiblePackageMatch(string fileName, string id
Assert.Equal(expected, result);
}
}
}
}