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); }
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); }
public void GetFunctionLinkBuilder_ThrowsArgumentNull_Function() { // Arrange IEdmModel model = new EdmModel(); // Act & Assert Assert.ThrowsArgumentNull(() => model.GetFunctionLinkBuilder(function: null), "function"); }