private T Generate(DraftBuilderType draftBuilderType, TData?data) { return(faker.Generate <T>(c => { c.RuleForType(_ => draftBuilderType); c.RuleForPropNameOf(nameof(IDraftsBuilderMeta <TData> .BuilderData), _ => data); })); }
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; }
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; }
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) =>
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"); }
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>(); }
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)); }