GetApiKey() private method

private GetApiKey ( string source ) : string
source string
return string
Example #1
0
        public void DeleteCommandUsesUpApiKeyIfSpecifiedAsAnUnnammedArgument()
        {
            // Arrange
            var guid = "1234-5678-9801-2345";
            var deleteCommand = new DeleteCommand(new Mock<IPackageSourceProvider>(MockBehavior.Strict).Object, new Mock<ISettings>(MockBehavior.Strict).Object);
            deleteCommand.Arguments.AddRange(new[] { "NuGet.CommandLine", "1.0", guid });

            // Act
            var result = deleteCommand.GetApiKey("Foo");

            // Assert
            Assert.Equal(guid, result);
        }
Example #2
0
        public void DeleteCommandPrefersApiKeySpecifiedAsANamedArgument()
        {
            // Arrange
            var namedGuid = "2345-9801-5678-1234";
            var unnamedGuid = "1234-5678-9801-2345";
            var deleteCommand = new DeleteCommand(new Mock<IPackageSourceProvider>(MockBehavior.Strict).Object, new Mock<ISettings>(MockBehavior.Strict).Object)
            {
                ApiKey = namedGuid
            };
            deleteCommand.Arguments.AddRange(new[] { "NuGet.CommandLine", "1.0", unnamedGuid });

            // Act
            var result = deleteCommand.GetApiKey("Foo");

            // Assert
            Assert.Equal(namedGuid, result);
        }