public void SingleNavigationNodeHandlesNullEntitySetOnParentNode()
        {
            var source = new FakeSingleEntityNode(HardCodedTestModel.GetPersonTypeReference(), null);
            var node   = new SingleNavigationNode(HardCodedTestModel.GetPersonMyDogNavProp(), source);

            node.NavigationSource.Should().BeNull();
        }
        public void KindIsEntitySet()
        {
            var source = FakeSingleEntityNode.CreateFakeSingleEntityNodeForPerson();
            var node   = new SingleNavigationNode(HardCodedTestModel.GetPersonMyDogNavProp(), source);

            node.InternalKind.Should().Be(InternalQueryNodeKind.SingleNavigationNode);
        }
        public void EntityTypeIsSameAsType()
        {
            var source = FakeSingleEntityNode.CreateFakeSingleEntityNodeForPerson();
            var node   = new SingleNavigationNode(HardCodedTestModel.GetPersonMyDogNavProp(), source);

            node.EntityTypeReference.Should().BeSameAs(node.TypeReference);
        }
        public void EntitySetIsCalculatedCorrectly()
        {
            var source = FakeSingleEntityNode.CreateFakeSingleEntityNodeForPerson();
            var node   = new SingleNavigationNode(HardCodedTestModel.GetPersonMyDogNavProp(), source);

            node.NavigationSource.Should().BeSameAs(HardCodedTestModel.GetDogsSet());
        }
        public void SourceIsSet()
        {
            var source = FakeSingleEntityNode.CreateFakeSingleEntityNodeForPerson();
            var node   = new SingleNavigationNode(HardCodedTestModel.GetPersonMyDogNavProp(), source);

            node.Source.Should().BeSameAs(source);
        }
        public void TypeReferenceIsExactlyFromProperty()
        {
            var source = FakeSingleEntityNode.CreateFakeSingleEntityNodeForPerson();
            var node   = new SingleNavigationNode(HardCodedTestModel.GetPersonMyDogNavProp(), source);

            node.TypeReference.Should().BeSameAs(HardCodedTestModel.GetPersonMyDogNavProp().Type);
        }
        public void CollectionNavigationNodeConstructorRequiresManyMultiplicity()
        {
            var    source = FakeSingleEntityNode.CreateFakeSingleEntityNodeForPerson();
            Action create = () => new CollectionNavigationNode(HardCodedTestModel.GetPersonMyDogNavProp(), source);

            create.ShouldThrow <ArgumentException>().WithMessage(ODataErrorStrings.Nodes_CollectionNavigationNode_MustHaveManyMultiplicity);
        }
        public void CollectionNavigationNodeHandlesNullEntitySetOnParentNode()
        {
            var source             = new FakeSingleEntityNode(HardCodedTestModel.GetDogTypeReference(), null);
            var collectionCastNode = new CollectionNavigationNode(HardCodedTestModel.GetDogMyPeopleNavProp(), source);

            collectionCastNode.NavigationSource.Should().BeNull();
        }
        public void EntitySetShouldBeSet()
        {
            var source = FakeSingleEntityNode.CreateFakeSingleEntityNodeForDog();
            var node   = new CollectionNavigationNode(HardCodedTestModel.GetDogMyPeopleNavProp(), source);

            node.NavigationSource.Should().BeSameAs(HardCodedTestModel.GetPeopleSet());
        }
        public void EntityItemTypeShouldBeSameAsItemType()
        {
            var source = FakeSingleEntityNode.CreateFakeSingleEntityNodeForDog();
            var node   = new CollectionNavigationNode(HardCodedTestModel.GetDogMyPeopleNavProp(), source);

            node.EntityItemType.Should().BeSameAs(node.ItemType);
        }
        public void CollectionTypeShouldBeExactlyFromPropertyType()
        {
            var source = FakeSingleEntityNode.CreateFakeSingleEntityNodeForDog();
            var node   = new CollectionNavigationNode(HardCodedTestModel.GetDogMyPeopleNavProp(), source);

            node.CollectionType.Should().BeSameAs(HardCodedTestModel.GetDogMyPeopleNavProp().Type.AsCollection());
        }