Exemplo n.º 1
0
        public void When_Value_Is_Not_Set_GetRelatedEntities_Return_Empty_List()
        {
            // arrange
            var parser = new MultiNodeTreePickerParser();

            // act
            var result = parser.GetRelatedEntities(null).ToList();

            // assert
            Assert.IsNotNull(result);
            Assert.That(result.Count == 0);
        }
Exemplo n.º 2
0
        public void When_Value_Is_Set_GetRelatedEntities_Return_List_With_Related_Entities()
        {
            // arrange
            var contentUdi =
                "umb://document/ca4249ed2b234337b52263cabe5587d1,umb://document/ca4249ed2b234337b52263cabe5587d2,umb://media/ca4249ed2b234337b52263cabe5587d1";

            var parser = new MultiNodeTreePickerParser();

            // act
            var result = parser.GetRelatedEntities(contentUdi).ToList();

            // assert
            Assert.IsNotNull(result);
            Assert.That(result.Count == 3);
            Assert.That(result.Count(x => x.RelationType == RelationTypes.DocumentToDocument) == 2);
            Assert.That(result.Count(x => x.RelationType == RelationTypes.DocumentToMedia) == 1);

            Assert.That(result.Exists(x => x.RelatedEntityUdi.ToString() == "umb://document/ca4249ed2b234337b52263cabe5587d1" && x.RelationType == RelationTypes.DocumentToDocument));
            Assert.That(result.Exists(x => x.RelatedEntityUdi.ToString() == "umb://document/ca4249ed2b234337b52263cabe5587d2" && x.RelationType == RelationTypes.DocumentToDocument));
            Assert.That(result.Exists(x => x.RelatedEntityUdi.ToString() == "umb://media/ca4249ed2b234337b52263cabe5587d1" && x.RelationType == RelationTypes.DocumentToMedia));
        }