public void FunctionLink_PreservesFollowsConventions(bool value) { // Arrange ODataModelBuilder builder = ODataModelBuilderMocks.GetModelBuilderMock <ODataModelBuilder>(); FunctionConfiguration configuration = new FunctionConfiguration(builder, "IgnoreFunction"); configuration.Returns <int>(); Mock <IEdmTypeConfiguration> bindingParameterTypeMock = new Mock <IEdmTypeConfiguration>(); bindingParameterTypeMock.Setup(o => o.Kind).Returns(EdmTypeKind.Entity); Type entityType = typeof(object); bindingParameterTypeMock.Setup(o => o.ClrType).Returns(entityType); configuration.SetBindingParameter("IgnoreParameter", bindingParameterTypeMock.Object); configuration.HasFunctionLink((a) => { throw new NotImplementedException(); }, followsConventions: value); builder.AddOperation(configuration); builder.AddEntityType(entityType); // Act IEdmModel model = builder.GetEdmModel(); // Assert var function = Assert.Single(model.SchemaElements.OfType <IEdmFunction>()); OperationLinkBuilder functionLinkBuilder = model.GetOperationLinkBuilder(function); Assert.NotNull(functionLinkBuilder); Assert.Equal(value, functionLinkBuilder.FollowsConventions); }
public void Apply_FollowsConventions() { // Arrange ODataModelBuilder builder = new ODataModelBuilder(); FunctionConfiguration function = new FunctionConfiguration(builder, "IgnoreAction"); Mock <IEdmTypeConfiguration> mockBindingParameterType = new Mock <IEdmTypeConfiguration>(); mockBindingParameterType.Setup(o => o.Kind).Returns(EdmTypeKind.Entity); mockBindingParameterType.Setup(o => o.ClrType).Returns(typeof(int)); function.SetBindingParameter("IgnoreParameter", mockBindingParameterType.Object); FunctionLinkGenerationConvention convention = new FunctionLinkGenerationConvention(); // Act convention.Apply(function, builder); // Assert Assert.True(function.FollowsConventions); }
public void HasFunctionLink_SetsFollowsConventions(bool value) { // Arrange ODataModelBuilder builder = new ODataModelBuilder(); FunctionConfiguration function = new FunctionConfiguration(builder, "IgnoreFunction"); Mock <IEdmTypeConfiguration> bindingParameterTypeMock = new Mock <IEdmTypeConfiguration>(); bindingParameterTypeMock.Setup(o => o.Kind).Returns(EdmTypeKind.Entity); bindingParameterTypeMock.Setup(o => o.ClrType).Returns(typeof(int)); IEdmTypeConfiguration bindingParameterType = bindingParameterTypeMock.Object; function.SetBindingParameter("IgnoreParameter", bindingParameterType); // Act function.HasFunctionLink((a) => { throw new NotImplementedException(); }, followsConventions: value); // Assert Assert.Equal(value, function.FollowsConventions); }
public void HasFunctionLink_SetsFollowsConventions(bool value) { // Arrange ODataModelBuilder builder = new ODataModelBuilder(); FunctionConfiguration function = new FunctionConfiguration(builder, "IgnoreFunction"); Mock<IEdmTypeConfiguration> bindingParameterTypeMock = new Mock<IEdmTypeConfiguration>(); bindingParameterTypeMock.Setup(o => o.Kind).Returns(EdmTypeKind.Entity); IEdmTypeConfiguration bindingParameterType = bindingParameterTypeMock.Object; function.SetBindingParameter("IgnoreParameter", bindingParameterType, alwaysBindable: false); // Act function.HasFunctionLink((a) => { throw new NotImplementedException(); }, followsConventions: value); // Assert Assert.Equal(value, function.FollowsConventions); }
public void FunctionLink_PreservesFollowsConventions(bool value) { // Arrange ODataModelBuilder builder = ODataModelBuilderMocks.GetModelBuilderMock<ODataModelBuilder>(); FunctionConfiguration configuration = new FunctionConfiguration(builder, "IgnoreFunction"); configuration.Returns<int>(); Mock<IEdmTypeConfiguration> bindingParameterTypeMock = new Mock<IEdmTypeConfiguration>(); bindingParameterTypeMock.Setup(o => o.Kind).Returns(EdmTypeKind.Entity); Type entityType = typeof(object); bindingParameterTypeMock.Setup(o => o.ClrType).Returns(entityType); configuration.SetBindingParameter("IgnoreParameter", bindingParameterTypeMock.Object); configuration.HasFunctionLink((a) => { throw new NotImplementedException(); }, followsConventions: value); builder.AddProcedure(configuration); builder.AddEntityType(entityType); // Act IEdmModel model = builder.GetEdmModel(); // Assert var function = Assert.Single(model.SchemaElements.OfType<IEdmFunction>()); FunctionLinkBuilder functionLinkBuilder = model.GetFunctionLinkBuilder(function); Assert.NotNull(functionLinkBuilder); Assert.Equal(value, functionLinkBuilder.FollowsConventions); }
public void Apply_FollowsConventions() { // Arrange ODataModelBuilder builder = new ODataModelBuilder(); FunctionConfiguration function = new FunctionConfiguration(builder, "IgnoreAction"); Mock<IEdmTypeConfiguration> mockBindingParameterType = new Mock<IEdmTypeConfiguration>(); mockBindingParameterType.Setup(o => o.Kind).Returns(EdmTypeKind.Entity); mockBindingParameterType.Setup(o => o.ClrType).Returns(typeof(int)); function.SetBindingParameter("IgnoreParameter", mockBindingParameterType.Object); FunctionLinkGenerationConvention convention = new FunctionLinkGenerationConvention(); // Act convention.Apply(function, builder); // Assert Assert.True(function.FollowsConventions); }