Beispiel #1
0
        public void SingleInheritedEntityBoundActionTest(string entitySetName, string actionName)
        {
            ActionTestsClient.Container cntr = new ActionTestsClient.Container(new Uri(BaseAddress));

            int newRating = 8;
            var product   = cntr.Execute <ODataActionTests_Product>(new Uri(string.Format("{0}/odata/{1}(4)/WebStack.QA.Test.OData.ModelBuilder.ODataActionTests_RatedProduct/{2}", BaseAddress, entitySetName, actionName)),
                                                                    "POST", true,
                                                                    new BodyOperationParameter("newRating", newRating)).Single();

            Assert.NotNull(product);
            Assert.Equal(4, product.ID);
            Assert.Equal(newRating, ((ODataActionTests_RatedProduct)product).Rating);
        }
Beispiel #2
0
        public void SingleEntityBoundActionTest(string entitySetName, string actionName)
        {
            ActionTestsClient.Container cntr = new ActionTestsClient.Container(new Uri(BaseAddress));

            DateTime dt      = Convert.ToDateTime("2025-01-01T00:00:00");
            var      product = cntr.Execute <ODataActionTests_Product>(new Uri(string.Format("{0}/odata/{1}(1)/{2}", BaseAddress, entitySetName, actionName)),
                                                                       "POST", true,
                                                                       new BodyOperationParameter("newDate", dt)).Single();

            Assert.NotNull(product);
            Assert.Equal(1, product.ID);
            Assert.True(product.SupportedUntil.Equals(dt));
        }
Beispiel #3
0
        public void CollectionOfInheritedEntitiesBoundActionTest(string entitySetName, string actionName)
        {
            ActionTestsClient.Container cntr = new ActionTestsClient.Container(new Uri(BaseAddress));

            int newRating = 10;
            var products  = cntr.Execute <ODataActionTests_Product>(new Uri(string.Format("{0}/odata/{1}/WebStack.QA.Test.OData.ModelBuilder.ODataActionTests_RatedProduct/{2}", BaseAddress, entitySetName, actionName)),
                                                                    "POST", true,
                                                                    new BodyOperationParameter("productIds", new int[] { 4 }),
                                                                    new BodyOperationParameter("newRating", newRating)).ToList();

            Assert.NotNull(products);
            Assert.Equal(1, products.Count());

            foreach (ODataActionTests_Product prod in products)
            {
                Assert.Equal(newRating, ((ODataActionTests_RatedProduct)prod).Rating);
            }
        }
Beispiel #4
0
        public void CollectionOfEntitiesBoundActionTest(string entitySetName, string actionName)
        {
            ActionTestsClient.Container cntr = new ActionTestsClient.Container(new Uri(BaseAddress));

            DateTime dt       = Convert.ToDateTime("2025-01-01T00:00:00");
            var      products = cntr.Execute <ODataActionTests_Product>(new Uri(string.Format("{0}/odata/{1}/{2}", BaseAddress, entitySetName, actionName)),
                                                                        "POST", true,
                                                                        new BodyOperationParameter("productIds", new int[] { 1, 2, 3, 4 }),
                                                                        new BodyOperationParameter("newDate", dt)).ToList();

            Assert.NotNull(products);
            Assert.Equal(4, products.Count());

            foreach (ODataActionTests_Product prod in products)
            {
                Assert.True(prod.SupportedUntil.Equals(dt));
            }
        }