예제 #1
0
        public void GivenXPathFilterHasThreeDocTypeSpecialCharacter_WhenTryParseXPathFilter_ThenReturnFalse()
        {
            var docTypeListXPath = new DocTypeListXPath();
            var canParse         = docTypeListXPath.IsValid(DocTypeListXPathTestsConsts.ThreeDocTypeSpecialCharacter);

            canParse.Should().BeFalse();
        }
예제 #2
0
        public void GivenXPathFilterHasTwoDocTypesPipeDelimitedAndSpecialCharacters_WhenTryParseXPathFilter_ThenReturnFalse()
        {
            var docTypeListXPath = new DocTypeListXPath();
            var canParse         = docTypeListXPath.IsValid(DocTypeListXPathTestsConsts.TwoDocTypeSpecialCharacters);

            canParse.Should().BeFalse();
        }
예제 #3
0
        public void GivenXPathFilterHasThreeDocTypeDocListXPath_WhenTryParseXPathFilter_ThenReturnTrue()
        {
            var docTypeListXPath = new DocTypeListXPath();
            var canParse         = docTypeListXPath.IsValid(DocTypeListXPathTestsConsts.ThreeDocTypeDocListXPath);

            canParse.Should().BeTrue();
        }
예제 #4
0
        public void GivenXPathFilterHasOneDocTypeAndNoSpecialCharacters_WhenTryParseXPathFilter_ThenReturnTrue()
        {
            var docTypeListXPath = new DocTypeListXPath();
            var canParse         = docTypeListXPath.IsValid(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath);

            canParse.Should().BeTrue();
        }
예제 #5
0
        public void GivenXPathFilterHasNoDocTypes_WhenIAddAHomepageDocType_ThenXPathFilterReturnedWillHaveHomepage()
        {
            var docTypeListXPath = new DocTypeListXPath();

            docTypeListXPath.Add("Homepage");
            docTypeListXPath.ToString().Should().Be("Homepage");
        }
예제 #6
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);
        }
예제 #7
0
        public void GivenXPathFilterIsTwoDocTypeNonPipeDelimited_WhenTryParseXPathFilter_ThenReturnFalse()
        {
            var docTypeListXPath = new DocTypeListXPath();
            var canParse         = docTypeListXPath.IsValid(DocTypeListXPathTestsConsts.TwoDocTypeNonPipeDelimited);

            canParse.Should().BeFalse();
        }
예제 #8
0
        public void GivenXPathFilterHasExistingDocType_WhenITryAddingNullAsDocType_ThenFluentExceptionWillBeRaised()
        {
            var    docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath);
            Action a = () => docTypeListXPath.Add(null);

            a.ShouldThrow <FluentException>();
        }
예제 #9
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);
        }
예제 #10
0
        public void GivenDocTypeXPathFilterHasTwoDocTypeWithUnderscore_WhenICallIsValid_ResultIsTrue()
        {
            var docTypeXPathFilter = new DocTypeListXPath();
            var result             = docTypeXPathFilter.IsValid(DocTypeListXPathTestsConsts.TwoDocTypeUnderscore);

            result.Should().BeTrue();
        }
예제 #11
0
        public void GivenIHaveOneDocTypeInFilter_WhenIAddAnother_ThenThereWillBeTwoDocTypesPipeDelimited()
        {
            var docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.OneDocTypeDocListXPath);

            docTypeListXPath.Add("ContentPage");
            docTypeListXPath.ToString().Should().Be("Homepage,ContentPage");
        }
예제 #12
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);
        }
예제 #13
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);
        }
예제 #14
0
        public void WhenTryAddTwoDocTypesAndOneIsEmptyString_ThenFluentExceptionIsThrown()
        {
            var    docTypeListXPath = new DocTypeListXPath();
            Action a = () => docTypeListXPath.Add("Homepage", "");

            a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingAddedIsEmptyOrNull);
        }
예제 #15
0
        public void WhenTryRemoveTheSameDocTypeAtOnce_ThenFluentExceptionIsThrownWithMessageThatDocTypeDoesntExist()
        {
            var    docTypeListXPath = new DocTypeListXPath();
            Action a = () => docTypeListXPath.Remove("Homepage", "Homepage");

            a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingRemovedDoesntExist);
        }
예제 #16
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);
        }
예제 #17
0
        public void WhenTryAddTheSameDocTypeAtOnce_ThenFluentExceptionISThrown()
        {
            var    docTypeListXPath = new DocTypeListXPath();
            Action a = () => docTypeListXPath.Add("Homepage", "Homepage");

            a.ShouldThrow <FluentException>().And.Message.Should().Be(DocTypeListXPathTestsConsts.DocTypeBeingAddedAlreadyExists);
        }
예제 #18
0
        public void GivenXPathFilterHasHomepageAndContentPage_WhenIRemoveNull_ThenXPathFilterReturnedWillOnlyHaveHomepage()
        {
            var    docTypeListXPath = new DocTypeListXPath(DocTypeListXPathTestsConsts.TwoDocTypeDocListXPath);
            Action a = () => docTypeListXPath.Remove(null);

            a.ShouldThrow <FluentException>();
        }
예제 #19
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);
        }
예제 #20
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");
        }
예제 #21
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);
        }
예제 #22
0
        public void GivenXPathFilterIsEmpty_WhenAddHomepageAndCategory_ThenResultIsHomepageCategoryInCorrectFormat()
        {
            var docTypeListXPath = new DocTypeListXPath();

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

            result.Should().Be("Homepage,Category");
        }
예제 #23
0
        public void WhenITryAddThreeDocTypesToXPath_ResultIsHomepageCategoryArticle()
        {
            var docTypeListXPath = new DocTypeListXPath();

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

            result.Should().Be("Homepage,Category,Article");
        }
예제 #24
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);
        }