Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AGD-1300 Test Followup #10211

Merged
merged 4 commits into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions test/DynamoCoreTests/DSLibraryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ public void TestAddStandardLibraryPath()
List<string> customPackageFolders = CurrentDynamoModel.PreferenceSettings.CustomPackageFolders;

// Test that the default number of folders is correct
Assert.IsTrue(customPackageFolders.Count == 1);
Assert.IsTrue(customPackageFolders.Count == 2);

// Test that the path is added as expected
CurrentDynamoModel.AddPackagePath(TestDirectory, "");
Assert.IsTrue(customPackageFolders.Count == 2);
Assert.IsTrue(customPackageFolders.Count == 3);

// Test that the path is not duplicated
CurrentDynamoModel.AddPackagePath(TestDirectory, "");
Assert.IsTrue(customPackageFolders.Count == 2);
Assert.IsTrue(customPackageFolders.Count == 3);
}

[Test]
Expand All @@ -232,21 +232,21 @@ public void TestAddDllLibraryPath()
List<string> customPackageFolders = CurrentDynamoModel.PreferenceSettings.CustomPackageFolders;

// Test that the default number of folders is correct
Assert.IsTrue(customPackageFolders.Count == 1);
Assert.IsTrue(customPackageFolders.Count == 2);

string filename = @"DLL.dll";
string packagePath = Path.Combine(TestDirectory, @"pkgs\Custom Rounding\extra");
string libraryPath = Path.Combine(packagePath, filename);

// Test that the full file path is added as expected
CurrentDynamoModel.AddPackagePath(packagePath, filename);
Assert.IsTrue(customPackageFolders.Count == 2);
Assert.IsTrue(customPackageFolders.Count == 3);
int count = customPackageFolders.Where(s => s == libraryPath).Count();
Assert.IsTrue(count == 1);

// Test that the full file path is not duplicated
CurrentDynamoModel.AddPackagePath(packagePath, filename);
Assert.IsTrue(customPackageFolders.Count == 2);
Assert.IsTrue(customPackageFolders.Count == 3);
count = customPackageFolders.Where(s => s == libraryPath).Count();
Assert.IsTrue(count == 1);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using DynamoUtilities;
using NUnit.Framework;

namespace DynamoUtilitiesTests
{
class CertificateVerificationTests
{
[Test]
[Category("UnitTests")]
public void CheckAssemblyForValidCertificateTest()
{
var executingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var directory = new DirectoryInfo(executingDirectory);
var testFilePath = Path.Combine(directory.Parent.Parent.Parent.FullName, "test", "pkgs_signed", "Signed Package", "bin", "Package.dll");

Assert.IsTrue(File.Exists(testFilePath));

Assert.IsTrue(DynamoUtilities.CertificateVerification.CheckAssemblyForValidCertificate(testFilePath));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<Compile Include="..\..\..\src\AssemblySharedInfoGenerator\AssemblySharedInfo.cs">
<Link>AssemblySharedInfo.cs</Link>
</Compile>
<Compile Include="CertificateVerificationTests.cs" />
<Compile Include="DataMarshalerTests.cs" />
<Compile Include="ProductLookUpTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
3 changes: 3 additions & 0 deletions test/Libraries/PackageManagerTests/PackageLoaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ public void ScanPackageDirectoryWithCheckingCertificatesEnabledWillNotLoadPackag
}

[Test]
//Todo need to add a new signed package file with unique name space
[Category("Failure")]
public void ScanPackageDirectoryWithCheckingCertificatesEnabledWillLoadPackageWithValidCertificate()
{
var loader = new PackageLoader(new[] { PackagesDirectory }, new[] { PackagesDirectorySigned });
Expand All @@ -550,6 +552,7 @@ public void ScanPackageDirectoryWithCheckingCertificatesEnabledWillLoadPackageWi

// Assert that ScanPackageDirectory returns a package
Assert.IsNotNull(pkg);
Assert.IsTrue(pkg.RequiresSignedEntryPoints);
loader.LoadPackages(new List<Package> { pkg });

// Verify that package resolved successfully
Expand Down