public void GivenXPathFilterHasThreeDocTypeSpecialCharacter_WhenTryParseXPathFilter_ThenReturnFalse() { var docTypeListXPath = new DocTypeListXPath(); var canParse = docTypeListXPath.IsValid(DocTypeListXPathTestsConsts.ThreeDocTypeSpecialCharacter); canParse.Should().BeFalse(); }
public void GivenXPathFilterHasTwoDocTypesPipeDelimitedAndSpecialCharacters_WhenTryParseXPathFilter_ThenReturnFalse() { var docTypeListXPath = new DocTypeListXPath(); var canParse = docTypeListXPath.IsValid(DocTypeListXPathTestsConsts.TwoDocTypeSpecialCharacters); canParse.Should().BeFalse(); }
public void GivenXPathFilterHasThreeDocTypeDocListXPath_WhenTryParseXPathFilter_ThenReturnTrue() { var docTypeListXPath = new DocTypeListXPath(); var canParse = docTypeListXPath.IsValid(DocTypeListXPathTestsConsts.ThreeDocTypeDocListXPath); canParse.Should().BeTrue(); }
public void GivenXPathFilterHasOneDocTypeAndNoSpecialCharacters_WhenTryParseXPathFilter_ThenReturnTrue() { var docTypeListXPath = new DocTypeListXPath(); var canParse = docTypeListXPath.IsValid(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath); canParse.Should().BeTrue(); }
public void GivenXPathFilterHasNoDocTypes_WhenIAddAHomepageDocType_ThenXPathFilterReturnedWillHaveHomepage() { var docTypeListXPath = new DocTypeListXPath(); docTypeListXPath.Add("Homepage"); docTypeListXPath.ToString().Should().Be("Homepage"); }
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 GivenXPathFilterIsTwoDocTypeNonPipeDelimited_WhenTryParseXPathFilter_ThenReturnFalse() { var docTypeListXPath = new DocTypeListXPath(); var canParse = docTypeListXPath.IsValid(DocTypeListXPathTestsConsts.TwoDocTypeNonPipeDelimited); canParse.Should().BeFalse(); }
public void GivenXPathFilterHasExistingDocType_WhenITryAddingNullAsDocType_ThenFluentExceptionWillBeRaised() { var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath); Action a = () => docTypeListXPath.Add(null); a.ShouldThrow <FluentException>(); }
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 GivenDocTypeXPathFilterHasTwoDocTypeWithUnderscore_WhenICallIsValid_ResultIsTrue() { var docTypeXPathFilter = new DocTypeListXPath(); var result = docTypeXPathFilter.IsValid(DocTypeListXPathTestsConsts.TwoDocTypeUnderscore); result.Should().BeTrue(); }
public void GivenIHaveOneDocTypeInFilter_WhenIAddAnother_ThenThereWillBeTwoDocTypesPipeDelimited() { var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath); docTypeListXPath.Add("ContentPage"); docTypeListXPath.ToString().Should().Be("Homepage,ContentPage"); }
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 WhenTryToRemoveDocTypeThatDoesntExistInFilter_ThenFluentExceptionIsRaised() { var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.TwoDocTypeDocListXPath); Action a = () => docTypeListXPath.Remove("RandomDocType"); a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingRemovedDoesntExist); }
public void WhenTryAddTwoDocTypesAndOneIsEmptyString_ThenFluentExceptionIsThrown() { var docTypeListXPath = new DocTypeListXPath(); Action a = () => docTypeListXPath.Add("Homepage", ""); a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingAddedIsEmptyOrNull); }
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 WhenITryAndAddADocTypeAliasThatAlreadyExists_ThenFluentExceptionWillBeRaisedWithAppropriateMessage() { var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath); Action a = () => docTypeListXPath.Add("Homepage"); a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingAddedAlreadyExists); }
public void WhenTryAddTheSameDocTypeAtOnce_ThenFluentExceptionISThrown() { var docTypeListXPath = new DocTypeListXPath(); Action a = () => docTypeListXPath.Add("Homepage", "Homepage"); a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingAddedAlreadyExists); }
public void GivenXPathFilterHasHomepageAndContentPage_WhenIRemoveNull_ThenXPathFilterReturnedWillOnlyHaveHomepage() { var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.TwoDocTypeDocListXPath); Action a = () => docTypeListXPath.Remove(null); a.ShouldThrow <FluentException>(); }
public void GivenXPathFilterHasExistingDocType_WhenITryAddingStringEmptyAsDocType_ThenFluentExceptionWillBeRaised() { var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath); Action a = () => docTypeListXPath.Add(string.Empty); a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingAddedIsEmptyOrNull); }
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 void GivenXPathFilterIsEmpty_WhenAddHomepageAndCategory_ThenResultIsHomepageCategoryInCorrectFormat() { var docTypeListXPath = new DocTypeListXPath(); docTypeListXPath.Add("Homepage", "Category"); var result = docTypeListXPath.ToString(); result.Should().Be("Homepage,Category"); }
public void WhenITryAddThreeDocTypesToXPath_ResultIsHomepageCategoryArticle() { var docTypeListXPath = new DocTypeListXPath(); docTypeListXPath.Add("Homepage", "Category", "Article"); var result = docTypeListXPath.ToString(); result.Should().Be("Homepage,Category,Article"); }
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); }