public async Task Mock_DatastoreContext_Contains() { var ret = (await mock_context.Contains("test", "t")).ToList(); Assert.AreEqual(4, ret.Count()); Assert.AreEqual("Two", ret.First().Label); }
public async Task <IResponse <IEnumerable <LookupItem> > > QueryDatastore_Contains(string accessor, string query) { var resp = new EnumerableResponse <LookupItem>(); if (string.IsNullOrWhiteSpace(query)) { resp.Status = Enums.ResponseStatus.NoResponse; } else { try { var data = await _datastoreContext.Contains(accessor, query); if (data == null || (data != null && data.Count() == 0)) { resp.Status = Enums.ResponseStatus.NoResponse; } else { resp.Data = data.OrderBy(x => x.Label); resp.Status = Enums.ResponseStatus.OK; } } catch (Exception e) { resp.Status = Enums.ResponseStatus.Error; resp.Exception = e; } } return(resp); }