Пример #1
0
 public static void ClassCleanUp()
 {
     var orchestrate = new Orchestrate(TestHelper.ApiKey);
     orchestrate.DeleteCollection(CollectionName);
     orchestrate.DeleteCollection("GraphTestCollection2");
     orchestrate.DeleteCollection("GraphTestCollection3");
 }
Пример #2
0
        public static void ClassCleanUp()
        {
            var orchestrate = new Orchestrate(TestHelper.ApiKey);

            orchestrate.DeleteCollection(CollectionName);
            orchestrate.DeleteCollection("GraphTestCollection2");
            orchestrate.DeleteCollection("GraphTestCollection3");
        }
Пример #3
0
        public void CreateCollectionWithItemAsJsonString()
        {
            // Set up
            const string collectionName = "TestCollection02";
            var          orchestration  = new Orchestrate(ApiKey);
            var          item           = new TestData {
                Id = 1, Value = "CreateCollectionWithItemAsJsonString"
            };
            var json = JsonConvert.SerializeObject(item);

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

                Assert.IsTrue(result.Path.Ref.Length > 0);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                orchestration.DeleteCollection(collectionName);
            }
        }
Пример #4
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");
        }
Пример #5
0
        public void DeleteCollectionNoName()
        {
            // Set up
            const string collectionName = "TestCollection04";
            var          orchestration  = new Orchestrate(ApiKey);
            var          item           = new TestData {
                Id = 1, Value = "DeleteCollection"
            };
            var json = JsonConvert.SerializeObject(item);

            try
            {
                orchestration.CreateCollection(collectionName, Guid.NewGuid().ToString(), json);
                orchestration.DeleteCollection(string.Empty);
            }
            catch (ArgumentNullException ex)
            {
                Assert.IsTrue(ex.ParamName == "collectionName");
                orchestration.DeleteCollection(collectionName);
                return;
            }

            Assert.Fail("No Exception Thrown");
        }
Пример #6
0
        public void DeleteNonExistantCollection()
        {
            // Set up
            var orchestration = new Orchestrate(ApiKey);

            try
            {
                var result = orchestration.DeleteCollection("NonExistantCollection");

                Assert.IsTrue(result.Path.Collection.Length > 0);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Пример #7
0
        public void CreateCollectionNoItem()
        {
            // Set up
            const string collectionName = "TestCollection05";
            var          orchestration  = new Orchestrate(ApiKey);

            try
            {
                orchestration.CreateCollection(collectionName, Guid.NewGuid().ToString(), null);
            }
            catch (ArgumentNullException ex)
            {
                Assert.IsTrue(ex.ParamName == "item");
                return;
            }

            orchestration.DeleteCollection(collectionName);
            Assert.Fail("No Exception Thrown");
        }
Пример #8
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");
        }
        public void CreateCollectionWithItemAsObjectAsync()
        {
            // Set up
            const string collectionName = "TestCollection01";
            var orchestration = new Orchestrate(TestHelper.ApiKey);
            var item = new TestData {Id = 1, Value = "CreateCollectionWithItemAsObject"};

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

                Assert.IsTrue(result.Path.Ref.Length > 0);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                orchestration.DeleteCollection(collectionName);
            }
        }
Пример #10
0
        public void CreateCollectionNoKey()
        {
            // Set up
            const string collectionName = "TestCollection04";
            var          orchestration  = new Orchestrate(ApiKey);
            var          item           = new TestData {
                Id = 1, Value = "CreateCollectionNoCollectionName"
            };

            try
            {
                orchestration.CreateCollection(collectionName, string.Empty, item);
            }
            catch (ArgumentNullException ex)
            {
                Assert.IsTrue(ex.ParamName == "key");
                return;
            }

            orchestration.DeleteCollection(collectionName);
            Assert.Fail("No Exception Thrown");
        }
Пример #11
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");
        }
Пример #12
0
        public void CreateCollectionWithItemAsJsonString()
        {
            // 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.Put(collectionName, Guid.NewGuid().ToString(), json);

                Assert.IsTrue(result.Path.Ref.Length > 0);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                orchestration.DeleteCollection(collectionName);
            }
        }
Пример #13
0
        public void CreateCollectionWithItemAsObjectAsync()
        {
            // Set up
            const string collectionName = "TestCollection01";
            var          orchestration  = new Orchestrate(TestHelper.ApiKey);
            var          item           = new TestData {
                Id = 1, Value = "CreateCollectionWithItemAsObject"
            };

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

                Assert.IsTrue(result.Path.Ref.Length > 0);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                orchestration.DeleteCollection(collectionName);
            }
        }
Пример #14
0
        public void DeleteCollectionNoName()
        {
            // 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
            {
                orchestration.Put(collectionName, Guid.NewGuid().ToString(), json);
                orchestration.DeleteCollection(string.Empty);
            }
            catch (ArgumentNullException ex)
            {
                Assert.IsTrue(ex.ParamName == "collectionName");
                orchestration.DeleteCollection(collectionName);
                return;
            }

            Assert.Fail("No Exception Thrown");
        }
Пример #15
0
        public void CreateCollectionNoKey()
        {
            // Set up
            const string collectionName = "TestCollection04";
            var orchestration = new Orchestrate(TestHelper.ApiKey);
            var item = new TestData {Id = 1, Value = "CreateCollectionNoCollectionName"};

            try
            {
                orchestration.Put(collectionName, string.Empty, item);
            }
            catch (ArgumentNullException ex)
            {
                Assert.IsTrue(ex.ParamName == "key");
                return;
            }

            orchestration.DeleteCollection(collectionName);
            Assert.Fail("No Exception Thrown");
        }
Пример #16
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.PutAsync(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");
        }
Пример #17
0
        public void CreateCollectionNoItem()
        {
            // Set up
            const string collectionName = "TestCollection05";
            var orchestration = new Orchestrate(TestHelper.ApiKey);

            try
            {
                orchestration.Put(collectionName, Guid.NewGuid().ToString(), (object) null);
            }
            catch (ArgumentNullException ex)
            {
                Assert.IsTrue(ex.ParamName == "item");
                return;
            }

            orchestration.DeleteCollection(collectionName);
            Assert.Fail("No Exception Thrown");
        }
Пример #18
0
        public void CreateCollectionNoItemAsync()
        {
            // Set up
            const string collectionName = "TestCollection05";
            var orchestration = new Orchestrate(TestHelper.ApiKey);

            try
            {
                var result = orchestration.PutAsync(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");
        }
Пример #19
0
        public void DeleteNonExistantCollection()
        {
            // Set up
            var orchestration = new Orchestrate(TestHelper.ApiKey);

            try
            {
                var result = orchestration.DeleteCollection("NonExistantCollection");

                Assert.IsTrue(result.Path.Collection.Length > 0);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Пример #20
0
        public static void ClassCleanUp()
        {
            var orchestrate = new Orchestrate(ApiKey);

            orchestrate.DeleteCollection(CollectionName);
        }
Пример #21
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.PutAsync(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");
        }