Beispiel #1
0
        public void TestValidSingleSearch1OptionField(string fieldName, string condition)
        {
            condition = condition.ToLowerString();

            string conditionValue1 = PhaseHelper.GetValueField(defaultResource, records.Data[$"{defaultResource.ToPrivateEnum()}{num}"].Records.Id.ToString(), new List <string> {
                fieldName
            }).Select(item => (item.PhaseObject as Option).ActualXMLTag).ToList().Random();
            string conditionValue2 = PhaseHelper.GetValueField(defaultResource, records.Data[$"{defaultResource.ToPrivateEnum()}{num}"].Records.Id.ToString(), new List <string> {
                fieldName
            }).Select(item => (item.PhaseObject as Option).ActualXMLTag).ToList().Random();

            Dictionary <string, object> parameters = new Dictionary <string, object>()
            {
                { PhaseApiFields.Partition, AuthenticationInfoProvider.Current.DefaultPartition },
                { PhaseApiFields.Resource, (int)defaultResource },
                { PhaseApiFields.Condition, $"{fieldName}:{condition}={conditionValue1}:{conditionValue2}" },
                { PhaseApiFields.Field, fieldName },
            };

            ReadResponseData <Phase> result = PublicApiAdapter.CreateAdapterForDefaultConnection().ReadSuccess <Phase>(parameters);

            Assert.That(result.Code, Is.EqualTo(Enums.PublicAPIResultCode.Success), string.Format(Enums.Message.READ_RESOURCE_FAILED, nameof(Phase)));

            foreach (var item in result.Items)
            {
                Assert.That((item.DictionaryValues[fieldName] as Option).ActualXMLTag, PhaseHelper.OptionConditionsMap[condition](conditionValue1, conditionValue2), DateTimeValidator.ErrorMessage);
            }
        }