本文整理汇总了C#中Microsoft.OData.Edm.Library.EdmModel.GetFunctionLinkBuilder方法的典型用法代码示例。如果您正苦于以下问题:C# EdmModel.GetFunctionLinkBuilder方法的具体用法?C# EdmModel.GetFunctionLinkBuilder怎么用?C# EdmModel.GetFunctionLinkBuilder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.OData.Edm.Library.EdmModel
的用法示例。
在下文中一共展示了EdmModel.GetFunctionLinkBuilder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFunctionLinkBuilderForFeed_After_SetActionLinkBuilder
public void GetFunctionLinkBuilderForFeed_After_SetActionLinkBuilder()
{
// Arrange
IEdmModel model = new EdmModel();
IEdmFunction function = new Mock<IEdmFunction>().Object;
FunctionLinkBuilder builder = new FunctionLinkBuilder((FeedContext _) => null, followsConventions: false);
// Act
model.SetFunctionLinkBuilder(function, builder);
var result = model.GetFunctionLinkBuilder(function);
// Assert
Assert.Same(builder, result);
}
示例2: GetFunctionLinkBuilderForFeed_ReturnsDefaultActionLinkBuilder_IfNotSet
public void GetFunctionLinkBuilderForFeed_ReturnsDefaultActionLinkBuilder_IfNotSet()
{
// Arrange
IEdmModel model = new EdmModel();
IEdmTypeReference returnType = EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Boolean, isNullable: false);
EdmFunction function = new EdmFunction("NS", "Function", returnType);
function.AddParameter("entityset",
new EdmCollectionTypeReference(
new EdmCollectionType(new EdmEntityTypeReference(new EdmEntityType("NS", "Customer"), false))));
// Act
FunctionLinkBuilder builder = model.GetFunctionLinkBuilder(function);
// Assert
Assert.NotNull(builder);
Assert.Null(builder.LinkFactory);
Assert.NotNull(builder.FeedLinkFactory);
Assert.IsType<Func<FeedContext, Uri>>(builder.FeedLinkFactory);
}
示例3: GetFunctionLinkBuilder_ThrowsArgumentNull_Function
public void GetFunctionLinkBuilder_ThrowsArgumentNull_Function()
{
// Arrange
IEdmModel model = new EdmModel();
// Act & Assert
Assert.ThrowsArgumentNull(() => model.GetFunctionLinkBuilder(function: null), "function");
}