private T Generate(DraftBuilderType draftBuilderType, TData?data)
 {
     return(faker.Generate <T>(c =>
     {
         c.RuleForType(_ => draftBuilderType);
         c.RuleForPropNameOf(nameof(IDraftsBuilderMeta <TData> .BuilderData), _ => data);
     }));
 }
示例#2
0
        public DraftsBuilderDocumentMeta(DraftBuilderType builderType, DraftsBuilderDocumentData?builderData)
        {
            if (builderType.IsEmpty)
            {
                throw Errors.ValueShouldNotBeEmpty(nameof(builderType));
            }

            BuilderType = builderType;
            BuilderData = builderData;
        }
 public DraftsBuilderMetaRequest(
     SenderRequest sender,
     AccountInfoRequest payer,
     RecipientInfoRequest recipient,
     DraftBuilderType builderType,
     DraftsBuilderData?builderData)
 {
     Sender      = sender ?? throw new ArgumentNullException(nameof(sender));
     Payer       = payer ?? throw new ArgumentNullException(nameof(payer));
     Recipient   = recipient ?? throw new ArgumentNullException(nameof(recipient));
     BuilderType = builderType;
     BuilderData = builderData;
 }
示例#4
0
        public DraftsBuilderDocumentFileMeta(string fileName, DraftBuilderType builderType, DraftsBuilderDocumentFileData?builderData)
        {
            if (string.IsNullOrWhiteSpace(fileName))
            {
                throw Errors.JsonDoesNotContainProperty(nameof(fileName));
            }

            if (builderType.IsEmpty)
            {
                throw Errors.ValueShouldNotBeEmpty(nameof(builderType));
            }

            FileName    = fileName;
            BuilderType = builderType;
            BuilderData = builderData;
        }
示例#5
0
        public DraftsBuilderMeta(
            DraftBuilderType builderType,
            DraftsBuilderData?builderData,
            Sender sender,
            AccountInfo payer,
            RecipientInfo recipient)
        {
            if (builderType.IsEmpty)
            {
                throw Errors.ValueShouldNotBeEmpty(nameof(builderType));
            }

            BuilderType = builderType;
            BuilderData = builderData;
            Sender      = sender ?? throw Errors.JsonDoesNotContainProperty(nameof(sender));
            Payer       = payer ?? throw Errors.JsonDoesNotContainProperty(nameof(payer));
            Recipient   = recipient ?? throw Errors.JsonDoesNotContainProperty(nameof(recipient));
        }
 public DraftsBuilderMetaRequest ChangeBuilderType(DraftBuilderType builderType, DraftsBuilderData?data) =>
示例#7
0
            public void Should_initialize_with_given_urn()
            {
                var documentType = new DraftBuilderType("urn:drafts-builder:fss-sedo-error-exchange-error");

                documentType.ToString().Should().Be("urn:drafts-builder:fss-sedo-error-exchange-error");
            }
示例#8
0
            public void Should_fail_when_urn_not_belong_to_draft_builder_type_namespace()
            {
                Action action = () => _ = new DraftBuilderType("urn:docflow:fss-sedo-sick-report-change-notification");

                action.Should().Throw <ArgumentException>();
            }
示例#9
0
            public void Should_fail_when_given_an_invalid_urn(string urn)
            {
                Action action = () => _ = new DraftBuilderType(urn);

                action.Should().Throw <Exception>();
            }
 public T GenerateWithoutType(DraftBuilderType draftBuilderType) =>
 faker.Generate <T>(c =>
 {
     c.RuleForType(_ => draftBuilderType);
     c.WithSkip <T>(x => x.BuilderData);
 });
        public T GenerateWithData(Type?dataType, DraftBuilderType draftBuilderType)
        {
            var data = dataType is null?unknownDataFactory() : (TData?)faker.Generate(dataType) ?? unknownDataFactory();

            return(Generate(draftBuilderType, data));
        }