public void InjectMetadataBuilderShouldSetBuilderOnEntry() { var entry = new ODataResource(); var builder = new TestEntityMetadataBuilder(entry); testSubject.InjectMetadataBuilder(entry, builder); entry.MetadataBuilder.Should().BeSameAs(builder); }
public void InjectMetadataBuilderShouldNotSetBuilderOnEntry() { var entry = new ODataResource(); var builder = new TestEntityMetadataBuilder(entry); testSubject.InjectMetadataBuilder(entry, builder); entry.MetadataBuilder.Should().BeOfType <NoOpResourceMetadataBuilder>(); }
public void InjectMetadataBuilderShouldSetBuilderOnEntryMediaResource() { var entry = new ODataResource(); var builder = new TestEntityMetadataBuilder(entry); entry.MediaResource = new ODataStreamReferenceValue(); testSubject.InjectMetadataBuilder(entry, builder); entry.MediaResource.GetMetadataBuilder().Should().BeSameAs(builder); }
public void InjectMetadataBuilderShouldNotSetBuilderOnEntryMediaResource() { var entry = new ODataResource(); var builder = new TestEntityMetadataBuilder(entry); entry.MediaResource = new ODataStreamReferenceValue(); testSubject.InjectMetadataBuilder(entry, builder); Assert.Null(entry.MediaResource.GetMetadataBuilder()); }
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 InjectMetadataBuilderShouldNotSetBuilderOnEntryActions() { var entry = new ODataResource(); 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(); }
public void InjectMetadataBuilderShouldNotSetBuilderOnEntryFunctions() { var entry = new ODataResource(); 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); Assert.Null(function1.GetMetadataBuilder()); Assert.Null(function2.GetMetadataBuilder()); }
public void InjectMetadataBuilderShouldSetBuilderOnEntryActions() { var entry = new ODataResource(); var builder = new TestEntityMetadataBuilder(entry); var action1 = new ODataAction { Metadata = new Uri(MetadataDocumentUri, "#action1") }; var action2 = new ODataAction { Metadata = new Uri(MetadataDocumentUri, "#action2") }; entry.AddAction(action1); entry.AddAction(action2); testSubject.InjectMetadataBuilder(entry, builder); Assert.Same(builder, action1.GetMetadataBuilder()); Assert.Same(builder, action2.GetMetadataBuilder()); }
public void InjectMetadataBuilderShouldSetBuilderOnEntryNamedStreamProperties() { var entry = new ODataResource(); 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().BeSameAs(builder); stream2.GetMetadataBuilder().Should().BeSameAs(builder); }