public async Task AddUrlCommand_NoOutputSpecified_Error()
        {
            // Arrange
            var currentDir = Directory.GetCurrentDirectory();
            var tempDir    = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            new DirectoryInfo(Path.Combine(currentDir, "TestAssets", "EmptyProject")).CopyTo(tempDir);

            // Act, Assert
            Directory.SetCurrentDirectory(tempDir);
            var command = new AddUrlCommand(new TestConsole(), CreateClient());
            await ExceptionAssert.ThrowsAsync <CLIToolException>(() => command.AddUrlAsync(Services.Server, Access.Internal, "ImportDir", SourceUrl, string.Empty)).DefaultTimeout();

            // Cleanup
            Directory.SetCurrentDirectory(currentDir);
            Directory.Delete(tempDir, true);
        }
        public async Task AddUrlCommand_AddsPackagesAndReferences()
        {
            // Arrange
            var currentDir = Directory.GetCurrentDirectory();
            var tempDir    = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            new DirectoryInfo(Path.Combine(currentDir, "TestAssets", "EmptyProject")).CopyTo(tempDir);

            // Act
            Directory.SetCurrentDirectory(tempDir);
            var command = new AddUrlCommand(new TestConsole(), CreateClient());
            await command.AddUrlAsync(Services.Server, Access.Internal, "ImportDir", SourceUrl, Path.Combine("Proto", "c.proto"));

            command.Project.ReevaluateIfNecessary();

            // Assert
            var packageRefs = command.Project.GetItems(CommandBase.PackageReferenceElement);

            Assert.AreEqual(1, packageRefs.Count);
            Assert.NotNull(packageRefs.SingleOrDefault(r => r.UnevaluatedInclude == "Grpc.AspNetCore" && !r.HasMetadata(CommandBase.PrivateAssetsElement)));

            var protoRefs = command.Project.GetItems(CommandBase.ProtobufElement);

            Assert.AreEqual(1, protoRefs.Count);
            var protoRef = protoRefs.Single();

            Assert.AreEqual(Path.Combine("Proto", "c.proto"), protoRef.UnevaluatedInclude);
            Assert.AreEqual("Server", protoRef.GetMetadataValue(CommandBase.GrpcServicesElement));
            Assert.AreEqual("ImportDir", protoRef.GetMetadataValue(CommandBase.AdditionalImportDirsElement));
            Assert.AreEqual("Internal", protoRef.GetMetadataValue(CommandBase.AccessElement));
            Assert.AreEqual(SourceUrl, protoRef.GetMetadataValue(CommandBase.SourceUrlElement));

            Assert.IsNotEmpty(File.ReadAllText(Path.Combine(command.Project.DirectoryPath, "Proto", "c.proto")));

            // Cleanup
            Directory.SetCurrentDirectory(currentDir);
            Directory.Delete(tempDir, true);
        }