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 GivenIHaveOneDocTypeInFilter_WhenIAddAnother_ThenThereWillBeTwoDocTypesPipeDelimited() { var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath); docTypeListXPath.Add("ContentPage"); docTypeListXPath.ToString().Should().Be("Homepage,ContentPage"); }
public void GivenXPathFilterHasExistingDocType_WhenITryAddingNullAsDocType_ThenFluentExceptionWillBeRaised() { var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath); Action a = () => docTypeListXPath.Add(null); a.ShouldThrow <FluentException>(); }
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 WhenTryAddTwoDocTypesAndOneIsStringDotEmpty_ThenFluentExceptionIsThrown() { var docTypeListXPath = new DocTypeListXPath(); Action a = () => docTypeListXPath.Add("Homepage", string.Empty); a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingAddedIsEmptyOrNull); }
public void GivenXPathFilterHasNoDocTypes_WhenIAddAHomepageDocType_ThenXPathFilterReturnedWillHaveHomepage() { var docTypeListXPath = new DocTypeListXPath(); docTypeListXPath.Add("Homepage"); docTypeListXPath.ToString().Should().Be("Homepage"); }
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 GivenDocTypeWithSpecialCharacter_WhenIAddToXPathFilterWithOneExistingDocType_ThenExceptionIsThrown() { var docTypeXPathFilter = new DocTypeListXPath("Homepage"); Action a = () => docTypeXPathFilter.Add("Current$Page"); a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.AddDocTypeWithSpecialCharacterExceptionMessage); }
public void GivenXPathFilterHasHomepageAndContentPage_WhenIRemoveEmptyString_ThenXPathFilterReturnedWillOnlyHaveHomepage() { var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath); Action a = () => docTypeListXPath.Add(""); a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingAddedIsEmptyOrNull); }
public void WhenITryAddThreeDocTypesToXPath_ResultIsHomepageCategoryArticle() { var docTypeListXPath = new DocTypeListXPath(); docTypeListXPath.Add("Homepage", "Category", "Article"); var result = docTypeListXPath.ToString(); result.Should().Be("Homepage,Category,Article"); }
public void GivenXPathFilterIsEmpty_WhenAddHomepageAndCategory_ThenResultIsHomepageCategoryInCorrectFormat() { var docTypeListXPath = new DocTypeListXPath(); docTypeListXPath.Add("Homepage", "Category"); var result = docTypeListXPath.ToString(); result.Should().Be("Homepage,Category"); }
public static IDataType AddDocTypeToXPathFilter(this IDataType dataType, params string[] docTypes) { var preValues = dataType.GetMultiNodeTreePickerPreValues(); var docTypeListXPath = new DocTypeListXPath(preValues.AllowedDocTypes); docTypeListXPath.Add(docTypes); preValues.AllowedDocTypes = docTypeListXPath.ToString(); dataType.SetMultiNodeTreePickerPreValues(preValues); return(dataType); }