Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (GH-1584) Fix Exception when source is null
  (GH-1704) Upgrade 7z to 18.6
  • Loading branch information
ferventcoder committed Jan 18, 2019
2 parents 8daccd4 + 7deb88e commit 572e9d8
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 5 deletions.
Binary file modified src/chocolatey.resources/tools/7z.dll
Binary file not shown.
Binary file modified src/chocolatey.resources/tools/7z.exe
Binary file not shown.
7 changes: 3 additions & 4 deletions src/chocolatey.tests/chocolatey.tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
<Compile Include="infrastructure.app\commands\ChocolateyUnpackSelfCommandSpecs.cs" />
<Compile Include="infrastructure.app\commands\ChocolateyUpgradeCommandSpecs.cs" />
<Compile Include="infrastructure.app\configuration\ConfigurationOptionsSpec.cs" />
<Compile Include="infrastructure.app\nuget\NugetCommonSpecs.cs" />
<Compile Include="infrastructure.app\services\AutomaticUninstallerServiceSpecs.cs" />
<Compile Include="infrastructure.app\services\FilesServiceSpecs.cs" />
<Compile Include="infrastructure.app\services\NugetServiceSpecs.cs" />
Expand Down Expand Up @@ -127,9 +128,7 @@
<Name>chocolatey.console</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="infrastructure.app\nuget\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand All @@ -138,4 +137,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
61 changes: 61 additions & 0 deletions src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright © 2017 - 2018 Chocolatey Software, Inc
// Copyright © 2011 - 2017 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.tests.infrastructure.app.nuget
{
using System;
using System.Linq;
using chocolatey.infrastructure.app.configuration;
using chocolatey.infrastructure.app.nuget;
using Moq;
using NuGet;
using Should;

public class NugetCommonSpecs
{
private class when_gets_remote_repository : TinySpec
{
private Action because;
private readonly Mock<ILogger> nugetLogger = new Mock<ILogger>();
private readonly Mock<IPackageDownloader> packageDownloader = new Mock<IPackageDownloader>();
private ChocolateyConfiguration configuration;
private IPackageRepository packageRepository;

public override void Context()
{
configuration = new ChocolateyConfiguration();
nugetLogger.ResetCalls();
packageDownloader.ResetCalls();
}

public override void Because()
{
because = () => packageRepository = NugetCommon.GetRemoteRepository(configuration, nugetLogger.Object, packageDownloader.Object);
}

[Fact]
public void should_create_repository_when_source_is_null()
{
Context();
configuration.Sources = null;

because();

((AggregateRepository)packageRepository).Repositories.Count().ShouldEqual(0);
}
}
}
}
2 changes: 1 addition & 1 deletion src/chocolatey/infrastructure.app/nuget/NugetCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static IPackageRepository GetRemoteRepository(ChocolateyConfiguration con
};
}

IEnumerable<string> sources = configuration.Sources.Split(new[] { ";", "," }, StringSplitOptions.RemoveEmptyEntries);
IEnumerable<string> sources = configuration.Sources.to_string().Split(new[] { ";", "," }, StringSplitOptions.RemoveEmptyEntries);

IList<IPackageRepository> repositories = new List<IPackageRepository>();

Expand Down

0 comments on commit 572e9d8

Please sign in to comment.