Ejemplo n.º 1
0
 public static void ClassCleanUp()
 {
     var orchestrate = new Orchestrate(TestHelper.ApiKey);
     orchestrate.DeleteCollection(CollectionName);
     orchestrate.DeleteCollection("GraphTestCollection2");
     orchestrate.DeleteCollection("GraphTestCollection3");
 }
Ejemplo n.º 2
0
        public static void ClassCleanUp()
        {
            var orchestrate = new Orchestrate(TestHelper.ApiKey);

            orchestrate.DeleteCollection(CollectionName);
            orchestrate.DeleteCollection("GraphTestCollection2");
            orchestrate.DeleteCollection("GraphTestCollection3");
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 9
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.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);
            }
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 20
0
        public static void ClassCleanUp()
        {
            var orchestrate = new Orchestrate(ApiKey);

            orchestrate.DeleteCollection(CollectionName);
        }
Ejemplo n.º 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");
        }