コード例 #1
0
        public void TestReadValidInputPhase(string fieldName, ReadValidInput valueType)
        {
            Enums.ResourceType resourceType = Enums.ResourceType.Client;
            string             fieldValue   = FieldValueMapperRead.ValidInputMapper[valueType];

            string id = recordsWithoutFieldInput.Data[$"{resourceType.ToPrivateEnum()}0"].Id.ToString();

            var phase = FieldHelper.CreatePhaseInstance(resourceType, id);

            if (valueType != ReadValidInput.NotSpecifiedDate)
            {
                phase.DictionaryValues[fieldName] = fieldValue;
            }

            id = ResourceHelper.WriteResource(phase, null);
            Assume.That(id, Is.Not.Null.And.Not.Empty, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, nameof(Phase)));

            //Read & verify the field's value
            if (valueType != ReadValidInput.NotSpecifiedDate)
            {
                DateTimeValidator.ReadAndVerifyDateForPhase(resourceType, id, fieldName, fieldValue);
            }
            else
            {
                DateTimeValidator.ReadAndVerifyAutoDesignatedDateForPhase(resourceType, id, fieldName);
            }

            if (valueType == ReadValidInput.NoValidation)
            {
                fieldValue = Util.ParseDateTime(FieldValueMapperRead.ValidInputMapper[ReadValidInput.NoValidation]).AddDays(1).ToString();

                var phaseUpdate = new Phase
                {
                    Id = id,
                };
                phaseUpdate.DictionaryValues[fieldName] = fieldValue;

                id = ResourceHelper.WriteResource(phaseUpdate, null);
                Assume.That(id, Is.Not.Null.And.Not.Empty, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, nameof(Phase)));
                DateTimeValidator.ReadAndVerifyNoValidationDateForPhase(resourceType, id, fieldName);
            }
        }