public RoslynPluginJarBuilder SetPluginManifestProperties(PluginManifest definition) { if (definition == null) { throw new ArgumentNullException(nameof(definition)); } SetNonNullManifestProperty(WellKnownPluginProperties.License, definition.License); SetNonNullManifestProperty(WellKnownPluginProperties.OrganizationUrl, definition.OrganizationUrl); SetNonNullManifestProperty(WellKnownPluginProperties.Version, definition.Version); SetNonNullManifestProperty(WellKnownPluginProperties.Homepage, definition.Homepage); SetNonNullManifestProperty(WellKnownPluginProperties.SourcesUrl, definition.SourcesUrl); SetNonNullManifestProperty(WellKnownPluginProperties.Developers, definition.Developers); SetNonNullManifestProperty(WellKnownPluginProperties.IssueTrackerUrl, definition.IssueTrackerUrl); SetNonNullManifestProperty(WellKnownPluginProperties.TermsAndConditionsUrl, definition.TermsConditionsUrl); SetNonNullManifestProperty(WellKnownPluginProperties.OrganizationName, definition.Organization); SetNonNullManifestProperty(WellKnownPluginProperties.PluginName, definition.Name); SetNonNullManifestProperty(WellKnownPluginProperties.Description, definition.Description); string key = definition.Key; PluginKeyUtilities.ThrowIfInvalid(key); this.SetManifestProperty(WellKnownPluginProperties.Key, key); return(this); }
private static void TestGetValidKey(string input, string expected) { string actual = PluginKeyUtilities.GetValidKey(input); Assert.AreEqual(expected, actual, "Unexpected plugin key returned"); PluginKeyUtilities.ThrowIfInvalid(expected); // should not throw on values returned by GetValidKey }
private void ValidateConfiguration() { // TODO: validate other inputs this.CheckPropertyIsSet(WellKnownPluginProperties.PluginName); string key = this.CheckPropertyIsSet(WellKnownPluginProperties.Key); PluginKeyUtilities.ThrowIfInvalid(key); if (string.IsNullOrWhiteSpace(this.JarFilePath)) { throw new InvalidOperationException(UIResources.Builder_Error_OutputJarPathMustBeSpecified); } }
private static void CheckThrowIfInvalidThrows(string input) { AssertException.Expect <ArgumentException>(() => PluginKeyUtilities.ThrowIfInvalid(input)); }
private static void CheckThrowIfInvalidThrows(string input) { Action action = () => PluginKeyUtilities.ThrowIfInvalid(input); action.Should().ThrowExactly <ArgumentException>(); }