/// <summary> /// Gets the layout name from template title. This method will strip and replace the special characters. /// </summary> /// <param name="templateTitle">The template title.</param> /// <returns></returns> public virtual string GetLayoutName(string templateTitle) { templateTitle = this.StripPackageNameFromTemplateName(templateTitle); var packagesManager = new PackageManager(); return packagesManager.StripInvalidCharacters(templateTitle); }
public void StripInvalidCharacters_TitleWithInvalidCharacters_VerifyStringIsProperlyInvalidated() { //Arrange: Initialize the PackageManager and a fake package name var packageManager = new PackageManager(); string title = "fake\\/Title<Name>With:Invalid?Chars\"And*Symbols|Included"; string cleanedTitle; //Act: clean the title cleanedTitle = packageManager.StripInvalidCharacters(title); //Assert: Verify if the manager properly strips all invalid characters Assert.AreEqual<string>("fake_Title_Name_With_Invalid_Chars_And_Symbols_Included", cleanedTitle, "Title is not striped correctly"); }