Exemplo n.º 1
0
        public void CanCreateTransientAction()
        {
            ODataModelBuilder builder = new ODataModelBuilder();
            EntityTypeConfiguration <Customer> customer = builder.Entity <Customer>();

            customer.TransientAction("Reward");

            ProcedureConfiguration action = builder.Procedures.SingleOrDefault();

            Assert.NotNull(action);
            Assert.True(action.IsBindable);
            Assert.False(action.IsAlwaysBindable);
        }
Exemplo n.º 2
0
        public void CanCreateEdmModel_WithTransientBindableAction()
        {
            // Arrange
            ODataModelBuilder builder = new ODataModelBuilder();
            EntityTypeConfiguration <Customer> customer = builder.Entity <Customer>();

            customer.HasKey(c => c.CustomerId);
            customer.Property(c => c.Name);
            // Act
            ActionConfiguration sendEmail = customer.TransientAction("ActionName");
            IEdmModel           model     = builder.GetEdmModel();

            // Assert
            IEdmEntityContainer container = model.EntityContainers().SingleOrDefault();

            Assert.NotNull(container);
            Assert.Equal(1, container.Elements.OfType <IEdmFunctionImport>().Count());
            IEdmFunctionImport action = container.Elements.OfType <IEdmFunctionImport>().Single();

            Assert.True(action.IsBindable);
            Assert.False(model.IsAlwaysBindable(action));
        }