コード例 #1
0
        private void PerformSingleKeywordTest(Enums.ResourceType resource, KeywordInputType inputType, ulong expectedRecordId)
        {
            var adapter = PublicApiAdapter.CreateAdapterForDefaultConnection();
            var records = adapter.ReadSuccess((resource.ToString()).ToString(), new Dictionary <string, object>
            {
                ["partition"] = AuthenticationInfoProvider.Current.DefaultPartition,
                ["keywords"]  = KeywordHelper.KeywordInput[inputType],
                ["count"]     = 200 //max count
            });

            Assert.That(records, Is.Not.Null, "Search request was not successful");
            Assert.That(records.Code, Is.EqualTo(Enums.PublicAPIResultCode.Success), "Search response code is not success");
            Assert.That(records.Items?.Select(x => x.DictionaryValues[$"{resource.ToPrivateEnum()}.P_Id"]), Has.Exactly(1).EqualTo(expectedRecordId.ToString()));
        }
コード例 #2
0
ファイル: KeywordInput.cs プロジェクト: fishxz/omni-bot
 public KeywordInput(KeywordInputType type, string label, string helpText)
 {
     _inputType = type;
     _label = label;
     _helpText = helpText;
 }
コード例 #3
0
 public KeywordInput(KeywordInputType type, string label, string helpText)
 {
     _inputType = type;
     _label     = label;
     _helpText  = helpText;
 }
コード例 #4
0
 private static string GetFieldValue(string fieldName, KeywordInputType inputType)
 {
     return(KeywordHelper.KeywordInput[inputType] + (fieldName.Contains("Mail") ? "@mail.com" : ""));
 }
コード例 #5
0
        public void TestSingleKeywordUserDefinedField(Enums.ResourceType resource, FieldType fieldType, KeywordInputType inputType)
        {
            var expectedRecordId = UserFieldsRecordCreator.Data.Single(x => (x.Key is RecordDescriptor) &&
                                                                       ((RecordDescriptor)x.Key).Resource == resource &&
                                                                       ((RecordDescriptor)x.Key).FieldName == FieldCreator.Data[$"{resource} {fieldType}"].Name &&
                                                                       ((RecordDescriptor)x.Key).FieldValue == inputType).Value.Id;

            PerformSingleKeywordTest(resource, inputType, expectedRecordId);
        }
コード例 #6
0
        public void TestSingleKeywordApplicationField(Enums.ResourceType resource, string fieldName, KeywordInputType inputType)
        {
            var expectedRecordId = ApplicationFieldsRecordCreator.Data.Single(x => (x.Key is RecordDescriptor) &&
                                                                              ((RecordDescriptor)x.Key).Resource == resource &&
                                                                              ((RecordDescriptor)x.Key).FieldName == fieldName &&
                                                                              ((RecordDescriptor)x.Key).FieldValue == inputType).Value.Id;

            PerformSingleKeywordTest(resource, inputType, expectedRecordId);
        }