-
Notifications
You must be signed in to change notification settings - Fork 563
Batch r nuget: commands #682
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
Conversation
| events | ||
| .Should() | ||
| .ContainSingle(e => e is NuGetPackageAdded); | ||
| .ContainSingle(e => e is DisplayedValueUpdated && ((DisplayedValueUpdated)e).Value.ToString().Contains("done!")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a much weaker assertion than checking for the specific event type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Immediately below is this assertion, which accurately verifies the event:
The line above verifies that the updated output text is produced.
events.OfType<PackageAdded>()
.Should()
.BeEquivalentTo(new NugetPackageReference("Microsoft.Extensions.Logging", "2.2.0"));
.ContainSingle(e => ((PackageAdded)e).PackageReference.PackageName == "Microsoft.Extensions.Logging"
&& ((PackageAdded)e).PackageReference.PackageVersion == "2.2.0");
Microsoft.DotNet.Interactive/Commands/LoadExtensionsInDirectory.cs
Outdated
Show resolved
Hide resolved
|
|
||
| namespace Microsoft.DotNet.Interactive.Commands | ||
| { | ||
| public class NugetRestoreDirective : KernelCommandBase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Command naming is typically imperative, e.g. RestoreNugetPackage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
K.
| IKernel kernel, | ||
| KernelInvocationContext context, | ||
| IEnumerable<FileInfo> additionalDependencies = null) | ||
| IEnumerable<string> additionalDependencies = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think additionalDependencies should be able to be removed in favor of something easier to understand. Not sure if you've seen an opportunity to do that but don't be worried about breaking existing extension functionality because it needs to be redone anyway.
| var packageKey = requestedPackage.PackageKey; | ||
|
|
||
| if (!string.IsNullOrEmpty(packageName) && _nugetPackageReferences.TryGetValue(requestedPackage, out _)) | ||
| lock (_packageReferences) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than needing a lock, you can use ConcurrentDictionary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
e625211 to
5191f5c
Compare
eabeea9 to
32459a0
Compare
| probingPaths)) | ||
| .ToDictionary(r => r.PackageName, StringComparer.OrdinalIgnoreCase); | ||
|
|
||
| lock (_lockObject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lock (_lockObject) [](start = 11, length = 19)
This lock looks unnecessary.
| { | ||
| public PackageRestoreResult( | ||
| bool succeeded, | ||
| IEnumerable<PackageReference> requestedPackages, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IEnumerable requestedPackages, [](start = 12, length = 48)
This is unused.
| } | ||
|
|
||
| [Fact] | ||
| public async Task PoundRNugetDisallowsEmptyPackageSpecification() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PoundRNugetDisallowsEmptyPackageSpecification [](start = 26, length = 45)
Test naming quibble: snake case please.
|
|
||
| namespace Microsoft.DotNet.Interactive.Commands | ||
| { | ||
| public class RestoreNugetDirective : KernelCommandBase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RestoreNugetDirective [](start = 17, length = 21)
Would RestorePackages capture the intent here? You've removed "Nuget" from other class names, and "Directive" sounds like the direct object here, which isn't accurate.
|
@jonsequitur I will resolve them On my PC and push another commit. |
| throw new System.ArgumentNullException(nameof(addPackage)); | ||
| } | ||
|
|
||
| PackageReference = addPackage.PackageReference; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's preferable to take in the PackageReference directly here. Then long as the parameter name matches the property name (case-insensitive), the deserialization will work correctly.
| .Last() | ||
| .Value | ||
| .Should() | ||
| .Be(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change? This doesn't look like the correct behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it isn't ...
|
@jonsequitur |
No description provided.