public static ContainsTemplateVariables ( [ value ) : bool | ||
value | [ | |
리턴 | bool |
/// <summary> /// Creates a new implementation version from a a string. /// </summary> /// <param name="value">The string containing the version information.</param> /// <exception cref="FormatException"><paramref name="value"/> is not a valid version string.</exception> public ImplementationVersion([NotNull] string value) { if (string.IsNullOrEmpty(value)) { throw new FormatException(Resources.MustStartWithDottedList); } if (ModelUtils.ContainsTemplateVariables(value)) { _verbatimString = value; _additionalParts = new VersionPart[0]; return; } string[] parts = value.Split('-'); // Ensure the first part is a dotted list if (!VersionDottedList.IsValid(parts[0])) { throw new FormatException(Resources.MustStartWithDottedList); } _firstPart = new VersionDottedList(parts[0]); // Iterate through all additional parts _additionalParts = new VersionPart[parts.Length - 1]; for (int i = 1; i < parts.Length; i++) { _additionalParts[i - 1] = new VersionPart(parts[i]); } }
public void TestContainsTemplateVariables() { ModelUtils.ContainsTemplateVariables("").Should().BeFalse(); ModelUtils.ContainsTemplateVariables("x").Should().BeFalse(); ModelUtils.ContainsTemplateVariables("}{").Should().BeFalse(); ModelUtils.ContainsTemplateVariables("{}").Should().BeTrue(); ModelUtils.ContainsTemplateVariables("{var}").Should().BeTrue(); ModelUtils.ContainsTemplateVariables("x{var}x").Should().BeTrue(); }
public void TestContainsTemplateVariables() { Assert.IsFalse(ModelUtils.ContainsTemplateVariables("")); Assert.IsFalse(ModelUtils.ContainsTemplateVariables("x")); Assert.IsFalse(ModelUtils.ContainsTemplateVariables("}{")); Assert.IsTrue(ModelUtils.ContainsTemplateVariables("{}")); Assert.IsTrue(ModelUtils.ContainsTemplateVariables("{var}")); Assert.IsTrue(ModelUtils.ContainsTemplateVariables("x{var}x")); }