Exemplo n.º 1
0
        public void AddGraph()
        {
            var data = new TestData {
                Id = 2, Value = "This is collection 2 data"
            };

            _orchestrate.CreateCollection("GraphTestCollection2", "2", data);

            var result = _orchestrate.PutGraph(CollectionName, "1", "toplevelgraph", "GraphTestCollection2", "2");

            Assert.IsTrue(result.Value == null || result.Value.ToString() == string.Empty);
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
        public static void ClassInitialize()
        {
            var orchestrate = new Orchestrate(TestHelper.ApiKey);
            var item        = new TestData {
                Id = 1, Value = "Inital Test Item"
            };

            orchestrate.CreateCollection(CollectionName, "1", item);
        }
Exemplo n.º 4
0
        public static void ClassInitialize(TestContext context)
        {
            var orchestrate = new Orchestrate(ApiKey);

            var item = new TestData {
                Id = 1, Value = "Inital Test Item"
            };
            var item2 = new TestData {
                Id = 2, Value = "Inital Test Item #2"
            };
            var item3 = new TestData {
                Id = 3, Value = "Inital Test Item #3"
            };

            orchestrate.CreateCollection(CollectionName, "1", item);
            orchestrate.Put(CollectionName, "2", item2);
            orchestrate.Put(CollectionName, "3", item3);
        }
Exemplo n.º 5
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");
        }
Exemplo n.º 6
0
        public void CreateCollectionNoCollectionName()
        {
            // Set up
            const string collectionName = "";
            var          orchestration  = new Orchestrate(ApiKey);
            var          item           = new TestData {
                Id = 1, Value = "CreateCollectionNoCollectionName"
            };

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

            Assert.Fail("No Exception Thrown");
        }
Exemplo n.º 7
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");
        }
Exemplo n.º 8
0
        public void DeleteCollectionAsync()
        {
            // Set up
            const string collectionName = "TestCollection03";
            var          orchestration  = new Orchestrate(TestHelper.ApiKey);
            var          item           = new TestData {
                Id = 1, Value = "DeleteCollection"
            };
            var json = JsonConvert.SerializeObject(item);

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

                Assert.IsTrue(result.Path.Collection.Length > 0);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Exemplo n.º 9
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");
        }