コード例 #1
0
        public void SingleInheritedEntityBoundActionTest(string entitySetName, string actionName)
        {
            Container cntr = new Container(new Uri(BaseAddress));

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

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

            DateTimeOffset dt = new DateTimeOffset(Convert.ToDateTime("2025-01-01T00:00:00"));

            var product = cntr.ExecuteAsync<ODataActionTests_Product>(
                new Uri(string.Format("{0}/odata/{1}(1)/Default.{2}", BaseAddress, entitySetName, actionName)),
                "POST",
                true,
                new BodyOperationParameter("newDate", dt)).Result.Single();

            Assert.NotNull(product);
            Assert.Equal(1, product.ID);
            Assert.True(product.SupportedUntil.Equals(dt));
        }
コード例 #3
0
        public void SingleEntityBoundActionTest(string entitySetName, string actionName)
        {
            Container cntr = new Container(new Uri(BaseAddress));

            DateTimeOffset dt = new DateTimeOffset(Convert.ToDateTime("2025-01-01T00:00:00"));

            var product = cntr.ExecuteAsync <ODataActionTests_Product>(
                new Uri(string.Format("{0}/odata/{1}(1)/Default.{2}", BaseAddress, entitySetName, actionName)),
                "POST",
                true,
                new BodyOperationParameter("newDate", dt)).Result.Single();

            Assert.NotNull(product);
            Assert.Equal(1, product.ID);
            Assert.True(product.SupportedUntil.Equals(dt));
        }
コード例 #4
0
        public void CollectionOfEntitiesBoundActionTest(string entitySetName, string actionName)
        {
            Container cntr = new Container(new Uri(BaseAddress));

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

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

            foreach (ODataActionTests_Product prod in products)
            {
                Assert.True(prod.SupportedUntil.Equals(dt));
            }
        }
コード例 #5
0
        public void CollectionOfEntitiesBoundActionTest(string entitySetName, string actionName)
        {
            Container cntr = new Container(new Uri(BaseAddress));

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

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

            foreach (ODataActionTests_Product prod in products)
            {
                Assert.True(prod.SupportedUntil.Equals(dt));
            }
        }
コード例 #6
0
        public void CollectionOfInheritedEntitiesBoundActionTest(string entitySetName, string actionName)
        {
            Container cntr = new Container(new Uri(BaseAddress));

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

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

            foreach (ODataActionTests_Product prod in products)
            {
                Assert.Equal(newRating, ((ODataActionTests_RatedProduct)prod).Rating);
            }
        }
コード例 #7
0
        public void SingleInheritedEntityBoundActionTest(string entitySetName, string actionName)
        {
            Container cntr = new Container(new Uri(BaseAddress));

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

            Assert.NotNull(product);
            Assert.Equal(4, product.ID);
            Assert.Equal(newRating, ((ODataActionTests_RatedProduct)product).Rating);
        }
コード例 #8
0
        public void CollectionOfInheritedEntitiesBoundActionTest(string entitySetName, string actionName)
        {
            Container cntr = new Container(new Uri(BaseAddress));

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

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

            foreach (ODataActionTests_Product prod in products)
            {
                Assert.Equal(newRating, ((ODataActionTests_RatedProduct)prod).Rating);
            }
        }