-
Notifications
You must be signed in to change notification settings - Fork 910
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…napshot (GH-121) Capture And Remove Files Related to Package Installation
- Loading branch information
Showing
32 changed files
with
1,309 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+110 Bytes
(100%)
src/chocolatey.tests.integration/context/installpackage/installpackage.1.0.0.nupkg
Binary file not shown.
6 changes: 5 additions & 1 deletion
6
src/chocolatey.tests.integration/context/installpackage/tools/chocolateyinstall.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
Write-Output "$env:PackageName $env:PackageVersion Installed" | ||
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" | ||
"simple file" | Out-File "$toolsDir\simplefile.txt" -force | ||
|
||
Write-Output "$env:PackageName $env:PackageVersion Installed" | ||
|
67 changes: 67 additions & 0 deletions
67
src/chocolatey.tests.integration/infrastructure/cryptography/CrytpoHashProviderSpecs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright © 2011 - 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.tests.integration.infrastructure.cryptography | ||
{ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Security.Cryptography; | ||
using Should; | ||
using chocolatey.infrastructure.cryptography; | ||
using chocolatey.infrastructure.filesystem; | ||
|
||
public class CrytpoHashProviderSpecs | ||
{ | ||
public abstract class CrytpoHashProviderSpecsBase : TinySpec | ||
{ | ||
protected CrytpoHashProvider Provider; | ||
protected DotNetFileSystem FileSystem; | ||
protected string ContextDirectory; | ||
|
||
public override void Context() | ||
{ | ||
FileSystem = new DotNetFileSystem(); | ||
Provider = new CrytpoHashProvider(FileSystem,CryptoHashProviderType.Md5); | ||
ContextDirectory = FileSystem.combine_paths(FileSystem.get_directory_name(Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", string.Empty)), "context"); | ||
} | ||
} | ||
|
||
public class when_HashProvider_provides_a_hash : CrytpoHashProviderSpecsBase | ||
{ | ||
private string result; | ||
private string filePath; | ||
|
||
public override void Context() | ||
{ | ||
base.Context(); | ||
filePath = FileSystem.combine_paths(ContextDirectory, "testing.packages.config"); | ||
} | ||
|
||
public override void Because() | ||
{ | ||
result = Provider.hash_file(filePath); | ||
} | ||
|
||
[Fact] | ||
public void should_provide_the_correct_hash_based_on_a_checksum() | ||
{ | ||
var expected = BitConverter.ToString(MD5.Create().ComputeHash(File.ReadAllBytes(filePath))).Replace("-", string.Empty); | ||
|
||
result.ShouldEqual(expected); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.