Exemplo n.º 1
0
        public static void ClassInitialize()
        {
            var orchestrate = new Orchestrate(TestHelper.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.Put(CollectionName, "1", item);
            orchestrate.Put(CollectionName, "2", item2);
            orchestrate.Put(CollectionName, "3", item3);
        }
Exemplo n.º 2
0
        public void PutAsObject()
        {
            var item = new TestData {
                Id = 3, Value = "A successful object PUT"
            };
            var result = _orchestrate.Put(CollectionName, Guid.NewGuid().ToString(), item);

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

            orchestrate.Put(CollectionName, "1", item);

            item.Value = "Updated Value";
            orchestrate.Patch(CollectionName, "1", item);
        }
        public void CreateCollectionWithItemAsObject()
        {
            // Set up
            const string collectionName = "TestCollection01";
            var orchestration = new Orchestrate(TestHelper.ApiKey);
            var item = new TestData {Id = 1, Value = "CreateCollectionWithItemAsObject"};

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

                Assert.IsTrue(result.Path.Ref.Length > 0);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                orchestration.DeleteCollection(collectionName);
            }
        }
        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");
        }
        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.Put(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);
            }
        }
        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");
        }
        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");
        }
Exemplo n.º 10
0
        public void CreateCollectionNoCollectionName()
        {
            // Set up
            const string collectionName = "";
            var orchestration = new Orchestrate(TestHelper.ApiKey);
            var item = new TestData {Id = 1, Value = "CreateCollectionNoCollectionName"};

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

            Assert.Fail("No Exception Thrown");
        }