Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public void GivenIHaveOneDocTypeInFilter_WhenIAddAnother_ThenThereWillBeTwoDocTypesPipeDelimited()
        {
            var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath);

            docTypeListXPath.Add("ContentPage");
            docTypeListXPath.ToString().Should().Be("Homepage,ContentPage");
        }
Esempio n. 3
0
        public void GivenXPathFilterHasExistingDocType_WhenITryAddingNullAsDocType_ThenFluentExceptionWillBeRaised()
        {
            var    docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath);
            Action a = () => docTypeListXPath.Add(null);

            a.ShouldThrow <FluentException>();
        }
Esempio n. 4
0
        public void WhenTryAddTheSameDocTypeAtOnce_ThenFluentExceptionISThrown()
        {
            var    docTypeListXPath = new DocTypeListXPath();
            Action a = () => docTypeListXPath.Add("Homepage", "Homepage");

            a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingAddedAlreadyExists);
        }
Esempio n. 5
0
        public void WhenTryAddTwoDocTypesAndOneIsStringDotEmpty_ThenFluentExceptionIsThrown()
        {
            var    docTypeListXPath = new DocTypeListXPath();
            Action a = () => docTypeListXPath.Add("Homepage", string.Empty);

            a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingAddedIsEmptyOrNull);
        }
Esempio n. 6
0
        public void GivenXPathFilterHasNoDocTypes_WhenIAddAHomepageDocType_ThenXPathFilterReturnedWillHaveHomepage()
        {
            var docTypeListXPath = new DocTypeListXPath();

            docTypeListXPath.Add("Homepage");
            docTypeListXPath.ToString().Should().Be("Homepage");
        }
Esempio n. 7
0
        public void WhenITryAndAddADocTypeAliasThatAlreadyExists_ThenFluentExceptionWillBeRaisedWithAppropriateMessage()
        {
            var    docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath);
            Action a = () => docTypeListXPath.Add("Homepage");

            a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingAddedAlreadyExists);
        }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
        public void GivenXPathFilterHasHomepageAndContentPage_WhenIRemoveEmptyString_ThenXPathFilterReturnedWillOnlyHaveHomepage()
        {
            var    docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath);
            Action a = () => docTypeListXPath.Add("");

            a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingAddedIsEmptyOrNull);
        }
Esempio n. 10
0
        public void WhenITryAddThreeDocTypesToXPath_ResultIsHomepageCategoryArticle()
        {
            var docTypeListXPath = new DocTypeListXPath();

            docTypeListXPath.Add("Homepage", "Category", "Article");
            var result = docTypeListXPath.ToString();

            result.Should().Be("Homepage,Category,Article");
        }
Esempio n. 11
0
        public void GivenXPathFilterIsEmpty_WhenAddHomepageAndCategory_ThenResultIsHomepageCategoryInCorrectFormat()
        {
            var docTypeListXPath = new DocTypeListXPath();

            docTypeListXPath.Add("Homepage", "Category");
            var result = docTypeListXPath.ToString();

            result.Should().Be("Homepage,Category");
        }
Esempio n. 12
0
        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);
        }