public void WhenTryToRemoveDocTypeThatDoesntExistInFilter_ThenFluentExceptionIsRaised() { var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.TwoDocTypeDocListXPath); Action a = () => docTypeListXPath.Remove("RandomDocType"); a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingRemovedDoesntExist); }
public void GivenXPathFilterHasHomepageAndContentPage_WhenIRemoveContentPage_ThenXPathFilterReturnedWillOnlyHaveHomepage() { var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath); Action a = () => docTypeListXPath.Remove(""); a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingRemovedIsEmptyOrNull); }
public void WhenTryRemoveTheSameDocTypeAtOnce_ThenFluentExceptionIsThrownWithMessageThatDocTypeDoesntExist() { var docTypeListXPath = new DocTypeListXPath(); Action a = () => docTypeListXPath.Remove("Homepage", "Homepage"); a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingRemovedDoesntExist); }
public void WhenTryRemoveTwoDocTypesAndOneIsStringDotEmpty_ThenFluentExceptionIsThrown() { var docTypeListXPath = new DocTypeListXPath("Homepage,Category"); Action a = () => docTypeListXPath.Remove("Category", string.Empty); a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingRemovedIsEmptyOrNull); }
public void GivenDocTypeWithSpecialCharacter_WhenIRemoveFromXPathFilterWithOneExistingDocType_ThenExceptionIsThrown() { var docTypeXPathFilter = new DocTypeListXPath("Homepage"); Action a = () => docTypeXPathFilter.Remove("Current$Page"); a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.RemoveDocTypeWithSpecialCharacterExceptionMessage); }
public void GivenXPathFilterHasHomepageAndContentPage_WhenIRemoveNull_ThenXPathFilterReturnedWillOnlyHaveHomepage() { var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.TwoDocTypeDocListXPath); Action a = () => docTypeListXPath.Remove(null); a.ShouldThrow <FluentException>(); }
public void GivenXPathFilterIsHomepageCategoryArticle_WhenITryRemoveCategoryArticle_ResultIsHomepage() { var docTypeListXPath = new DocTypeListXPath("Homepage,Category,Article"); docTypeListXPath.Remove("Category", "Article"); var result = docTypeListXPath.ToString(); result.Should().Be("Homepage"); }
public void GivenXPathFilterIsHomepageCategory_WhenRemoveHomepageAndCategory_ThenResultIsEmptyString() { var docTypeListXPath = new DocTypeListXPath("Homepage,Category"); docTypeListXPath.Remove("Homepage", "Category"); var result = docTypeListXPath.ToString(); result.Should().Be(string.Empty); }
public static IDataType RemoveDocTypeFromXPathFilter(this IDataType dataType, params string[] docTypes) { var preValues = dataType.GetMultiNodeTreePickerPreValues(); var docTypeListXPath = new DocTypeListXPath(preValues.AllowedDocTypes); docTypeListXPath.Remove(docTypes); preValues.AllowedDocTypes = docTypeListXPath.ToString(); dataType.SetMultiNodeTreePickerPreValues(preValues); return(dataType); }