diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateySourceCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateySourceCommandSpecs.cs
index aecaf9d987..55e6654e34 100644
--- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateySourceCommandSpecs.cs
+++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateySourceCommandSpecs.cs
@@ -355,7 +355,7 @@ public void should_call_service_source_add_when_command_is_add()
because();
configSettingsService.Verify(c => c.source_add(configuration), Times.Once);
}
-
+
[Fact]
public void should_call_service_source_remove_when_command_is_remove()
{
@@ -380,5 +380,23 @@ public void should_call_service_source_enable_when_command_is_enable()
configSettingsService.Verify(c => c.source_enable(configuration), Times.Once);
}
}
+
+ public class when_list_is_called : ChocolateySourceCommandSpecsBase
+ {
+ private Action because;
+
+ public override void Because()
+ {
+ because = () => command.list(configuration);
+ }
+
+ [Fact]
+ public void should_call_service_source_list_when_command_is_list()
+ {
+ configuration.SourceCommand.Command = SourceCommandType.list;
+ because();
+ configSettingsService.Verify(c => c.source_list(configuration), Times.Once);
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/chocolatey/chocolatey.csproj b/src/chocolatey/chocolatey.csproj
index 379c389c23..854bd24c55 100644
--- a/src/chocolatey/chocolatey.csproj
+++ b/src/chocolatey/chocolatey.csproj
@@ -161,6 +161,7 @@
+
diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs
index e62cafa7f8..537a24a7dc 100644
--- a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs
+++ b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs
@@ -28,7 +28,7 @@ namespace chocolatey.infrastructure.app.commands
[CommandFor(CommandNameType.sources)]
[CommandFor(CommandNameType.source)]
- public sealed class ChocolateySourceCommand : ICommand
+ public sealed class ChocolateySourceCommand : IListCommand
{
private readonly IChocolateyConfigSettingsService _configSettingsService;
@@ -139,5 +139,10 @@ public void run(ChocolateyConfiguration configuration)
break;
}
}
+
+ public IEnumerable list(ChocolateyConfiguration configuration)
+ {
+ return _configSettingsService.source_list(configuration);
+ }
}
-}
\ No newline at end of file
+}
diff --git a/src/chocolatey/infrastructure/commands/IListCommand.cs b/src/chocolatey/infrastructure/commands/IListCommand.cs
new file mode 100644
index 0000000000..d24a89ccb2
--- /dev/null
+++ b/src/chocolatey/infrastructure/commands/IListCommand.cs
@@ -0,0 +1,25 @@
+// Copyright © 2015 - Present RealDimensions Software, LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+//
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace chocolatey.infrastructure.commands
+{
+ using System.Collections.Generic;
+ using app.configuration;
+
+ public interface IListCommand : ICommand
+ {
+ IEnumerable list(ChocolateyConfiguration config);
+ }
+}