当前位置: 首页>>代码示例>>C#>>正文


C# ODataEntry.AddAction方法代码示例

本文整理汇总了C#中ODataEntry.AddAction方法的典型用法代码示例。如果您正苦于以下问题:C# ODataEntry.AddAction方法的具体用法?C# ODataEntry.AddAction怎么用?C# ODataEntry.AddAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ODataEntry的用法示例。


在下文中一共展示了ODataEntry.AddAction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InjectMetadataBuilderShouldNotSetBuilderOnEntryActions

        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();
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:14,代码来源:JsonNoMetadataLevelTests.cs

示例2: InjectMetadataBuilderShouldSetBuilderOnEntryActions

        public void InjectMetadataBuilderShouldSetBuilderOnEntryActions()
        {
            var entry = new ODataEntry();
            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);
            action1.GetMetadataBuilder().Should().BeSameAs(builder);
            action2.GetMetadataBuilder().Should().BeSameAs(builder);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:14,代码来源:JsonFullMetadataLevelTests.cs

示例3: ShouldWriteActionForRequestEntryPayloadWithUserModel

 public void ShouldWriteActionForRequestEntryPayloadWithUserModel()
 {
     ODataEntry entry = new ODataEntry { TypeName = "NS.MyDerivedEntityType" };
     entry.AddAction(new ODataAction { Metadata = new Uri("#Action1", UriKind.Relative) });
     const string expectedPayload = "{\"@odata.type\":\"#NS.MyDerivedEntityType\",\"#Action1\":{}}";
     Action action = () => this.WriteNestedItemsAndValidatePayload(entitySet: null, entityType: null, nestedItemToWrite: new[] { entry }, expectedPayload: expectedPayload, writingResponse: false);
     action.ShouldThrow<ODataException>().WithMessage(Strings.WriterValidationUtils_OperationInRequest("#Action1"));
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:8,代码来源:ODataJsonLightWriterShortSpanIntegrationTests.cs

示例4: NoOpMetadataBuilderShouldReturnActionsSetByUser

        public void NoOpMetadataBuilderShouldReturnActionsSetByUser()
        {
            ODataAction action = new ODataAction()
            {
                Metadata = new Uri("http://example.com/$metadata#Action"),
                Target = new Uri("http://example.com/Action"),
                Title = "ActionTitle"
            };

            ODataEntry entry = new ODataEntry();
            entry.AddAction(action);
            new NoOpEntityMetadataBuilder(entry).GetActions()
                .Should().ContainSingle(a => a == action);
            
            // Verify that the action information wasn't removed or changed.
            action.Metadata.Should().Be(new Uri("http://example.com/$metadata#Action"));
            action.Target.Should().Be(new Uri("http://example.com/Action"));
            action.Title.Should().Be("ActionTitle");
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:19,代码来源:NoOpEntityMetadataBuilderTests.cs

示例5: ShouldWriteActionForResponseEntryPayloadWithUserModel

 public void ShouldWriteActionForResponseEntryPayloadWithUserModel()
 {
     ODataEntry entry = new ODataEntry { TypeName = "NS.MyDerivedEntityType" };
     entry.AddAction(new ODataAction { Metadata = new Uri("#Action1", UriKind.Relative) });
     const string expectedPayload = "{\"@odata.context\":\"http://odata.org/test/$metadata#MySet/$entity\",\"@odata.type\":\"#NS.MyDerivedEntityType\",\"#Action1\":{}}";
     this.WriteNestedItemsAndValidatePayload(entitySet: this.entitySet, entityType: null, nestedItemToWrite: new[] { entry }, expectedPayload: expectedPayload, writingResponse: true);
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:7,代码来源:ODataJsonLightWriterShortSpanIntegrationTests.cs


注:本文中的ODataEntry.AddAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。