Exemple #1
0
        public void CreateCollectionWithItemAsJsonStringAsync()
        {
            // Set up
            const string collectionName = "TestCollection02";
            var          orchestration  = new Orchestrate(TestHelper.ApiKey);
            var          item           = new TestData {
                Id = 1, Value = "CreateCollectionWithItemAsJsonString"
            };
            var json = JsonConvert.SerializeObject(item);

            try
            {
                var result = orchestration.CreateCollectionAsync(collectionName, Guid.NewGuid().ToString(), json).Result;

                Assert.IsTrue(result.Path.Ref.Length > 0);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                orchestration.DeleteCollection(collectionName);
            }
        }
Exemple #2
0
        public void DeleteCollectionNoNameAsync()
        {
            // Set up
            const string collectionName = "TestCollection04";
            var          orchestration  = new Orchestrate(TestHelper.ApiKey);
            var          item           = new TestData {
                Id = 1, Value = "DeleteCollection"
            };
            var json = JsonConvert.SerializeObject(item);

            try
            {
                var result       = orchestration.CreateCollectionAsync(collectionName, Guid.NewGuid().ToString(), json).Result;
                var deleteResult = orchestration.DeleteCollectionAsync(string.Empty).Result;
            }
            catch (AggregateException ex)
            {
                var inner = ex.InnerExceptions.First() as ArgumentNullException;
                Assert.IsTrue(inner.ParamName == "collectionName");
                orchestration.DeleteCollection(collectionName);
                return;
            }

            Assert.Fail("No Exception Thrown");
        }
Exemple #3
0
        public void CreateCollectionNoItemAsync()
        {
            // Set up
            const string collectionName = "TestCollection05";
            var          orchestration  = new Orchestrate(TestHelper.ApiKey);

            try
            {
                var result = orchestration.CreateCollectionAsync(collectionName, Guid.NewGuid().ToString(), (object)null).Result;
            }
            catch (AggregateException ex)
            {
                var inner = ex.InnerExceptions.First() as ArgumentNullException;
                Assert.IsTrue(inner.ParamName == "item");
                return;
            }

            orchestration.DeleteCollection(collectionName);
            Assert.Fail("No Exception Thrown");
        }
Exemple #4
0
        public void CreateCollectionNoCollectionNameAsync()
        {
            // Set up
            const string collectionName = "";
            var          orchestration  = new Orchestrate(TestHelper.ApiKey);
            var          item           = new TestData {
                Id = 1, Value = "CreateCollectionNoCollectionName"
            };

            try
            {
                var result = orchestration.CreateCollectionAsync(collectionName, Guid.NewGuid().ToString(), item).Result;
            }
            catch (AggregateException ex)
            {
                var inner = ex.InnerExceptions.First() as ArgumentNullException;
                Assert.IsTrue(inner.ParamName == "collectionName");
                return;
            }

            Assert.Fail("No Exception Thrown");
        }
Exemple #5
0
        public void CreateCollectionNoKeyAsync()
        {
            // Set up
            const string collectionName = "TestCollection04";
            var          orchestration  = new Orchestrate(TestHelper.ApiKey);
            var          item           = new TestData {
                Id = 1, Value = "CreateCollectionNoCollectionName"
            };

            try
            {
                var result = orchestration.CreateCollectionAsync(collectionName, string.Empty, item).Result;
            }
            catch (AggregateException ex)
            {
                var inner = ex.InnerExceptions.First() as ArgumentNullException;
                Assert.IsTrue(inner.ParamName == "key");
                return;
            }

            orchestration.DeleteCollection(collectionName);
            Assert.Fail("No Exception Thrown");
        }