Esempio n. 1
0
        public void WhenTryToRemoveDocTypeThatDoesntExistInFilter_ThenFluentExceptionIsRaised()
        {
            var    docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.TwoDocTypeDocListXPath);
            Action a = () => docTypeListXPath.Remove("RandomDocType");

            a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingRemovedDoesntExist);
        }
Esempio n. 2
0
        public void GivenXPathFilterHasHomepageAndContentPage_WhenIRemoveContentPage_ThenXPathFilterReturnedWillOnlyHaveHomepage()
        {
            var    docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath);
            Action a = () => docTypeListXPath.Remove("");

            a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingRemovedIsEmptyOrNull);
        }
Esempio n. 3
0
        public void WhenTryRemoveTheSameDocTypeAtOnce_ThenFluentExceptionIsThrownWithMessageThatDocTypeDoesntExist()
        {
            var    docTypeListXPath = new DocTypeListXPath();
            Action a = () => docTypeListXPath.Remove("Homepage", "Homepage");

            a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingRemovedDoesntExist);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        public void GivenXPathFilterHasHomepageAndContentPage_WhenIRemoveNull_ThenXPathFilterReturnedWillOnlyHaveHomepage()
        {
            var    docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.TwoDocTypeDocListXPath);
            Action a = () => docTypeListXPath.Remove(null);

            a.ShouldThrow <FluentException>();
        }
Esempio n. 7
0
        public void GivenXPathFilterIsHomepageCategoryArticle_WhenITryRemoveCategoryArticle_ResultIsHomepage()
        {
            var docTypeListXPath = new DocTypeListXPath("Homepage,Category,Article");

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

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

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

            result.Should().Be(string.Empty);
        }
Esempio n. 9
0
        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);
        }