-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ignore non-package folders in package cache
- Loading branch information
Showing
2 changed files
with
62 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using FluentAssertions; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.IO; | ||
using System.Linq; | ||
|
||
namespace Firely.Fhir.Packages.Tests | ||
{ | ||
[TestClass] | ||
public class DiskPackageCacheTests | ||
{ | ||
[TestMethod] | ||
public void TestIgnoreInvalidPackageFolder() | ||
{ | ||
|
||
//Create new packageCache folder: | ||
// --testcache | ||
// ---- validpackage#1.0.0 | ||
// ---- invalidpackage | ||
// ---- #invalidpackage | ||
// ---- invalidpackage# | ||
|
||
string root = "testCache"; | ||
string validPackage = "validpackage#2.0.0"; | ||
string invalidPackage1 = "invalidpackage"; | ||
string invalidPackage2 = "#invalidpackage"; | ||
string invalidPackage3 = "invalidpackage#"; | ||
string invalidPackage4 = "invalidpackage#2.0.0#invalid"; | ||
|
||
|
||
Directory.CreateDirectory(root); | ||
Directory.CreateDirectory($"{root}/{validPackage}"); | ||
Directory.CreateDirectory($"{root}/{invalidPackage1}"); | ||
Directory.CreateDirectory($"{root}/{invalidPackage2}"); | ||
Directory.CreateDirectory($"{root}/{invalidPackage3}"); | ||
Directory.CreateDirectory($"{root}/{invalidPackage4}"); | ||
|
||
//Test | ||
var packageCache = new DiskPackageCache(root); | ||
var packages = packageCache.GetPackageReferences().Result; | ||
packages.Should().OnlyContain(x => x.Name == validPackage.Split('#', System.StringSplitOptions.None).First()); | ||
|
||
|
||
//Cleanup | ||
Directory.Delete(root, true); | ||
|
||
|
||
} | ||
|
||
} | ||
} |
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