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); }
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); }; }
public void TestSettingIDForEmptyJson() { var session = new CloudantSession("https://cloudant.com"); session.SetID("", "364fc3facb6936fd23b22ec8195e923f"); }
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); }; }