public void InjectMetadataBuilderShouldSetBuilderOnEntry()
        {
            var entry   = new ODataEntry();
            var builder = new TestEntityMetadataBuilder(entry);

            testSubject.InjectMetadataBuilder(entry, builder);
            entry.MetadataBuilder.Should().BeSameAs(builder);
        }
예제 #2
0
        public void InjectMetadataBuilderShouldNotSetBuilderOnEntry()
        {
            var entry   = new ODataEntry();
            var builder = new TestEntityMetadataBuilder(entry);

            testSubject.InjectMetadataBuilder(entry, builder);
            entry.MetadataBuilder.Should().BeOfType <NoOpEntityMetadataBuilder>();
        }
        public void InjectMetadataBuilderShouldNotSetBuilderOnEntryMediaResource()
        {
            var entry   = new ODataEntry();
            var builder = new TestEntityMetadataBuilder(entry);

            entry.MediaResource = new ODataStreamReferenceValue();
            testSubject.InjectMetadataBuilder(entry, builder);
            entry.MediaResource.GetMetadataBuilder().Should().BeNull();
        }
        public void InjectMetadataBuilderShouldNotSetBuilderOnEntryActions()
        {
            var entry   = new ODataEntry();
            var builder = new TestEntityMetadataBuilder(entry);
            var action1 = new ODataAction {
                Metadata = new Uri("http://service/$metadata#action1", UriKind.Absolute)
            };
            var action2 = new ODataAction {
                Metadata = new Uri("http://service/$metadata#action2", UriKind.Absolute)
            };

            entry.AddAction(action1);
            entry.AddAction(action2);

            testSubject.InjectMetadataBuilder(entry, builder);
            action1.GetMetadataBuilder().Should().BeNull();
            action2.GetMetadataBuilder().Should().BeNull();
        }
예제 #5
0
        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);
        }
        public void InjectMetadataBuilderShouldNotSetBuilderOnEntryNamedStreamProperties()
        {
            var entry   = new ODataEntry();
            var builder = new TestEntityMetadataBuilder(entry);
            var stream1 = new ODataStreamReferenceValue();
            var stream2 = new ODataStreamReferenceValue();

            entry.Properties = new[]
            {
                new ODataProperty {
                    Name = "Stream1", Value = stream1
                },
                new ODataProperty {
                    Name = "Stream2", Value = stream2
                }
            };
            testSubject.InjectMetadataBuilder(entry, builder);
            stream1.GetMetadataBuilder().Should().BeNull();
            stream2.GetMetadataBuilder().Should().BeNull();
        }