Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
2 changes: 1 addition & 1 deletion src/NuSeal/FileUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal static bool TryGetLicense(string mainAssemblyPath, string productName,
return false;
}

var licenseFileName = $"{productName}.license";
var licenseFileName = $"{productName}.lic";

try
{
Expand Down
18 changes: 9 additions & 9 deletions tests/NuSeal.Tests/FileUtils_TryGetLicenseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void ReturnsFalse_GivenNoLicenseFile()
public void ReturnsTrue_GivenLicenseFileInSameDirectory()
{
var licenseContent = "license-content";
var licenseFilePath = Path.Combine(_subSubDirectory, $"{_productName}.license");
var licenseFilePath = Path.Combine(_subSubDirectory, $"{_productName}.lic");
File.WriteAllText(licenseFilePath, licenseContent);

var result = FileUtils.TryGetLicense(_mainAssemblyPath, _productName, out string retrievedContent);
Expand All @@ -51,7 +51,7 @@ public void ReturnsTrue_GivenLicenseFileInSameDirectory()
public void ReturnsTrue_GivenLicenseFileInParentDirectory()
{
var licenseContent = "license-content";
var licenseFilePath = Path.Combine(_subDirectory, $"{_productName}.license");
var licenseFilePath = Path.Combine(_subDirectory, $"{_productName}.lic");
File.WriteAllText(licenseFilePath, licenseContent);

var result = FileUtils.TryGetLicense(_mainAssemblyPath, _productName, out string retrievedContent);
Expand All @@ -64,7 +64,7 @@ public void ReturnsTrue_GivenLicenseFileInParentDirectory()
public void ReturnsTrue_GivenLicenseFileInRootDirectory()
{
var licenseContent = "license-content";
var licenseFilePath = Path.Combine(_testRootDirectory, $"{_productName}.license");
var licenseFilePath = Path.Combine(_testRootDirectory, $"{_productName}.lic");
File.WriteAllText(licenseFilePath, licenseContent);

var result = FileUtils.TryGetLicense(_mainAssemblyPath, _productName, out string retrievedContent);
Expand All @@ -80,9 +80,9 @@ public void ReturnsFirstLicenseFound_GivenMultipleLicenseFiles()
var licenseContentParent = "license-content-parent";
var licenseContentSame = "license-content-same";

File.WriteAllText(Path.Combine(_testRootDirectory, $"{_productName}.license"), licenseContentRoot);
File.WriteAllText(Path.Combine(_subDirectory, $"{_productName}.license"), licenseContentParent);
File.WriteAllText(Path.Combine(_subSubDirectory, $"{_productName}.license"), licenseContentSame);
File.WriteAllText(Path.Combine(_testRootDirectory, $"{_productName}.lic"), licenseContentRoot);
File.WriteAllText(Path.Combine(_subDirectory, $"{_productName}.lic"), licenseContentParent);
File.WriteAllText(Path.Combine(_subSubDirectory, $"{_productName}.lic"), licenseContentSame);

var result = FileUtils.TryGetLicense(_mainAssemblyPath, _productName, out string retrievedContent);

Expand All @@ -95,7 +95,7 @@ public void ReturnsFirstLicenseFound_GivenMultipleLicenseFiles()
public void TrimsLicenseContent_GivenLicenseWithWhitespace()
{
var licenseContent = " license-content-with-whitespace \r\n ";
var licenseFilePath = Path.Combine(_subSubDirectory, $"{_productName}.license");
var licenseFilePath = Path.Combine(_subSubDirectory, $"{_productName}.lic");
File.WriteAllText(licenseFilePath, licenseContent);

var result = FileUtils.TryGetLicense(_mainAssemblyPath, _productName, out string retrievedContent);
Expand Down Expand Up @@ -140,7 +140,7 @@ public void UsesProductNameForLicenseFile_GivenDifferentProductNames()
var otherProductName = "OtherProduct";

// Create license file for a different product
File.WriteAllText(Path.Combine(_subSubDirectory, $"{otherProductName}.license"), licenseContent);
File.WriteAllText(Path.Combine(_subSubDirectory, $"{otherProductName}.lic"), licenseContent);

var result = FileUtils.TryGetLicense(_mainAssemblyPath, _productName, out string retrievedContent);

Expand All @@ -153,7 +153,7 @@ public void ReturnsFalse_GivenEmptyProductName()
{
var licenseContent = "license-content";
// Create license file with empty name
File.WriteAllText(Path.Combine(_subSubDirectory, ".license"), licenseContent);
File.WriteAllText(Path.Combine(_subSubDirectory, ".lic"), licenseContent);

var result = FileUtils.TryGetLicense(_mainAssemblyPath, "", out string retrievedContent);

Expand Down
2 changes: 1 addition & 1 deletion tests/NuSeal.Tests/ValidateLicenseTaskTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ private void CreateValidLicense(string productName)
PrivateKeyPem = _rsaPemPair.PrivateKey,
};
var license = License.Create(licenseParams);
var licenseFilePath = Path.Combine(_tempDir, $"{productName}.license");
var licenseFilePath = Path.Combine(_tempDir, $"{productName}.lic");
File.WriteAllText(licenseFilePath, license);
}

Expand Down