コード例 #1
0
        public void TestSettingIDSetByTheUser()
        {
            string document = "{\"id\":\"test\"}";
            string expected = "{\"_id\":\"364fc3facb6936fd23b22ec8195e923f\",\"id\":\"test\"}";
            var    session  = new CloudantSession("https://cloudant.com");
            var    actual   = session.SetID(document, "364fc3facb6936fd23b22ec8195e923f");

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void TestSettingIDByGettingOneFromCloudant()
        {
            using (ShimsContext.Create())
            {
                string document = "{\"id\":\"test\"}";
                string expected = "{\"_id\":\"364fc3facb6936fd23b22ec8195e923f\",\"id\":\"test\"}";
                ///Fake the response
                System.Net.Fakes.ShimWebClient.AllInstances.DownloadStringString = (c, u) =>
                {
                    return("{uuids: [\"364fc3facb6936fd23b22ec8195e923f\"]}");
                };

                var session = new CloudantSession("https://cloudant.com");
                var actual  = session.SetID(document, string.Empty);
                Assert.AreEqual(expected, actual);
            };
        }
コード例 #3
0
        public void TestSettingIDForEmptyJson()
        {
            var session = new CloudantSession("https://cloudant.com");

            session.SetID("", "364fc3facb6936fd23b22ec8195e923f");
        }
コード例 #4
0
 public void TestSettingIDSetByTheUser()
 {
     string document = "{\"id\":\"test\"}";
     string expected = "{\"_id\":\"364fc3facb6936fd23b22ec8195e923f\",\"id\":\"test\"}";
     var session = new CloudantSession("https://cloudant.com");
     var actual = session.SetID(document, "364fc3facb6936fd23b22ec8195e923f");
     Assert.AreEqual(expected, actual);
 }
コード例 #5
0
 public void TestSettingIDForEmptyJson()
 {
     var session = new CloudantSession("https://cloudant.com");
     session.SetID("", "364fc3facb6936fd23b22ec8195e923f");
 }
コード例 #6
0
        public void TestSettingIDByGettingOneFromCloudant()
        {
            using (ShimsContext.Create())
            {
                string document = "{\"id\":\"test\"}";
                string expected = "{\"_id\":\"364fc3facb6936fd23b22ec8195e923f\",\"id\":\"test\"}";
                ///Fake the response
                System.Net.Fakes.ShimWebClient.AllInstances.DownloadStringString = (c, u) =>
                {
                    return "{uuids: [\"364fc3facb6936fd23b22ec8195e923f\"]}";
                };

                var session = new CloudantSession("https://cloudant.com");
                var actual = session.SetID(document,string.Empty);
                Assert.AreEqual(expected, actual);
            };
        }