예제 #1
0
        public void FindNavigationTargetShouldReturnSetIfItIsFound()
        {
            var testSubject = new CsdlSemanticsEntitySet(this.semanticContainer, this.csdlEntitySet);
            var result      = testSubject.FindNavigationTarget(this.navigationProperty);

            result.Should().BeAssignableTo <CsdlSemanticsEntitySet>();
            result.As <CsdlSemanticsEntitySet>().Name.Should().Be("EntitySet");
            result.Errors().Should().BeEmpty();
        }
        public void FindNavigationTargetShouldReturnSetIfItIsFound()
        {
            var testSubject = new CsdlSemanticsEntitySet(this.semanticContainer, this.csdlEntitySet);
            var result      = testSubject.FindNavigationTarget(this.navigationProperty);
            var entitySet   = Assert.IsType <CsdlSemanticsEntitySet>(result);

            Assert.Equal("EntitySet", entitySet.Name);
            Assert.Empty(result.Errors());
        }
        private IEdmNavigationPropertyBinding ParseSingleBinding(string path, string target, CsdlLocation location = null)
        {
            var binding     = new CsdlNavigationPropertyBinding(path, target, location);
            var testSubject = new CsdlSemanticsEntitySet(this.semanticContainer, new CsdlEntitySet("Fake", "FQ.NS.EntityType", new[] { binding }, null));

            var result = Assert.Single(testSubject.NavigationPropertyBindings);

            return(result);
        }
예제 #4
0
        public void FindNavigationTargetShouldReturnUnresolvedEntitySetIfEntitySetIsNotFound()
        {
            var nonExistentBinding = new CsdlNavigationPropertyBinding("Navigation", "NonExistent", null, new CsdlLocation(1, 1));
            var testSubject        = new CsdlSemanticsEntitySet(this.semanticContainer, new CsdlEntitySet("Fake", "FQ.NS.EntityType", new[] { nonExistentBinding }, null, null));
            var result             = testSubject.FindNavigationTarget(this.navigationProperty);

            result.Should().BeAssignableTo <UnresolvedEntitySet>();
            result.As <UnresolvedEntitySet>().Name.Should().Be("NonExistent");
            result.Errors().Should().Contain(e => e.ErrorLocation == nonExistentBinding.Location && e.ErrorCode == EdmErrorCode.BadUnresolvedEntitySet);
        }
        public void FindNavigationTargetShouldReturnUnresolvedEntitySetIfEntitySetIsNotFound()
        {
            var nonExistentBinding = new CsdlNavigationPropertyBinding("Navigation", "NonExistent", new CsdlLocation(1, 1));
            var testSubject        = new CsdlSemanticsEntitySet(this.semanticContainer, new CsdlEntitySet("Fake", "FQ.NS.EntityType", new[] { nonExistentBinding }, null));
            var result             = testSubject.FindNavigationTarget(this.navigationProperty);
            var entitySet          = Assert.IsType <UnresolvedEntitySet>(result);

            Assert.Equal("NonExistent", entitySet.Name);
            Assert.Contains(result.Errors(), e => e.ErrorLocation == nonExistentBinding.Location && e.ErrorCode == EdmErrorCode.BadUnresolvedEntitySet);
        }
예제 #6
0
        public void FindNavigationTargetShouldReturnNullIfNavigationPropertyHasNoBinding()
        {
            var testSubject = new CsdlSemanticsEntitySet(this.semanticContainer, this.csdlEntitySet);

            Assert.IsTrue(testSubject.FindNavigationTarget(new CsdlSemanticsNavigationProperty(this.semanticEntityType, new CsdlNavigationProperty("Fake", "FQ.NS.EntityType", null, null, false, null, Enumerable.Empty <CsdlReferentialConstraint>(), null, null))) is IEdmUnknownEntitySet);
        }