Пример #1
0
        public void InjectMetadataBuilderShouldSetBuilderOnEntryFunctions()
        {
            var entry     = new ODataResource();
            var builder   = new TestEntityMetadataBuilder(entry);
            var function1 = new ODataFunction {
                Metadata = new Uri(MetadataDocumentUri, "#function1")
            };
            var function2 = new ODataFunction {
                Metadata = new Uri(MetadataDocumentUri, "#function2")
            };

            entry.AddFunction(function1);
            entry.AddFunction(function2);

            testSubject.InjectMetadataBuilder(entry, builder);
            function1.GetMetadataBuilder().Should().BeSameAs(builder);
            function2.GetMetadataBuilder().Should().BeSameAs(builder);
        }
        public void InjectMetadataBuilderShouldNotSetBuilderOnEntryFunctions()
        {
            var entry     = new ODataEntry();
            var builder   = new TestEntityMetadataBuilder(entry);
            var function1 = new ODataFunction {
                Metadata = new Uri("http://service/$metadata#function1", UriKind.Absolute)
            };
            var function2 = new ODataFunction {
                Metadata = new Uri("http://service/$metadata#function2", UriKind.Absolute)
            };

            entry.AddFunction(function1);
            entry.AddFunction(function2);

            testSubject.InjectMetadataBuilder(entry, builder);
            function1.GetMetadataBuilder().Should().BeNull();
            function2.GetMetadataBuilder().Should().BeNull();
        }
        public void InjectMetadataBuilderShouldNotSetBuilderOnEntryFunctions()
        {
            var entry = new ODataEntry();
            var builder = new TestEntityMetadataBuilder(entry);
            var function1 = new ODataFunction { Metadata = new Uri("http://service/$metadata#function1", UriKind.Absolute) };
            var function2 = new ODataFunction { Metadata = new Uri("http://service/$metadata#function2", UriKind.Absolute) };
            
            entry.AddFunction(function1);
            entry.AddFunction(function2);

            testSubject.InjectMetadataBuilder(entry, builder);
            function1.GetMetadataBuilder().Should().BeNull();
            function2.GetMetadataBuilder().Should().BeNull();
        }
        public void InjectMetadataBuilderShouldSetBuilderOnEntryFunctions()
        {
            var entry = new ODataEntry();
            var builder = new TestEntityMetadataBuilder(entry);
            var function1 = new ODataFunction { Metadata = new Uri(MetadataDocumentUri, "#function1") };
            var function2 = new ODataFunction { Metadata = new Uri(MetadataDocumentUri, "#function2") };

            entry.AddFunction(function1);
            entry.AddFunction(function2);

            testSubject.InjectMetadataBuilder(entry, builder);
            function1.GetMetadataBuilder().Should().BeSameAs(builder);
            function2.GetMetadataBuilder().Should().BeSameAs(builder);
        }