public void NuGetLicenseParser_ParsesLicensesCorrectly(string expression, bool hasStandardIdentifiers, bool hasPlus, bool allowUnlicensed) { var license = NuGetLicense.ParseIdentifier(expression, allowUnlicensed: allowUnlicensed); Assert.Equal(expression, license.ToString()); Assert.Equal(license.HasOnlyStandardIdentifiers(), hasStandardIdentifiers); Assert.Equal(hasPlus, license.Plus); Assert.Equal(expression.Equals(NuGetLicense.UNLICENSED), license.IsUnlicensed()); }
public void NuGetLicenseParser_ParsesUnlicensedCorrectly() { var expression = NuGetLicense.UNLICENSED; var license = NuGetLicense.ParseIdentifier(expression, allowUnlicensed: true); Assert.Equal(expression, license.ToString()); Assert.True(license.HasOnlyStandardIdentifiers()); Assert.True(license.IsUnlicensed()); Assert.False(license.Plus); }
private ActionResult DisplayLicense(NuGetLicense license) { return(DisplayLicenseFromFile(license.Identifier, isException: false)); }
private ActionResult UnknownLicense(NuGetLicense license) { return(UnknownLicense(license.Identifier)); }
[InlineData("UNLICENSED++", false)] // unlicensed++ is bad in both bases. public void NuGetLicenseParser_ThrowsForInvalidLicenseIdentifiers(string expression, bool allowUnlicensed) { Assert.Throws <NuGetLicenseExpressionParsingException>(() => NuGetLicense.ParseIdentifier(expression, allowUnlicensed: allowUnlicensed)); }