예제 #1
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Bluemix.Cloudant.CloudantSearch"/> class.
		/// </summary>
		/// <param name="ds">Datasource</param>
		public CloudantSearch(Datasource ds)
		{
			if (string.IsNullOrEmpty (ds.DatabaseName))
				throw new ArgumentException ("DatabaseName cannot be null or empty");
			_ds = ds;
			cloudantConfiguration = new CloudantConfiguration ();
			cloudantConfiguration.BasePath = string.Format (cloudantConfiguration.BasePath, ds.DBCredentials.UserName);
			client = new BluemixClient (ds.DBCredentials);

		}
예제 #2
0
		public async void CloudantGetByIDFailure ()
		{
			String testID = "foo";
			var testDbUser = "******";
			var testDbPassword = "******";
			var testDbName = "people";

			var ds = new Datasource (testDbName, 
				new Credentials (userName: testDbUser,
					password: testDbPassword));
			JObject retval = await ds.Search.GetById (testID);
			Assert.NotNull (retval.GetValue("error"));
			StringAssert.IsMatch("not_found",retval.GetValue ("error").ToString ());
		}
예제 #3
0
		public async void CloudantSearchByIDSuccess ()
		{
			String testID = "achebbi";
			var testDbUser = "******";
			var testDbPassword = "******";
			var testDbName = "people";

			var ds = new Datasource (testDbName, 
							new Credentials (userName: testDbUser,
							password: testDbPassword));
			SearchResult retval = await ds.Search.SearchById(testID);

			Assert.NotNull (retval);
			StringAssert.IsMatch(testID,retval.Rows[0].Id);
		}