static CacheResultTOperationTReturnTest()
        {
            ConstructorArgumentValidationTestScenarios.RemoveAllScenarios();
            ConstructorArgumentValidationTestScenarios
            .AddScenario(
                () =>
                new ConstructorArgumentValidationTestScenario <CacheResult <Version, Version> >
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'operation' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <CacheResult <Version, Version> >();

                    var result = new CacheResult <Version, Version>(
                        null,
                        referenceObject.CachedObject,
                        referenceObject.FreshnessInUtc);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[]
                {
                    "operation",
                },
            });
        }
Exemple #2
0
        static PercentCellValueFormatTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <PercentCellValueFormat>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'percentDisplayKind' is NumberFormatPercentDisplayKind.Unknown",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <PercentCellValueFormat>();

                    var result = new PercentCellValueFormat(
                        NumberFormatPercentDisplayKind.Unknown,
                        referenceObject.NumberOfDecimalPlaces,
                        referenceObject.DecimalSeparator,
                        referenceObject.DigitGroupKind,
                        referenceObject.DigitGroupSeparator,
                        referenceObject.NegativeNumberDisplayKind,
                        referenceObject.MissingValueText);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "percentDisplayKind", "Unknown" },
            });
        }
Exemple #3
0
        static ExecuteOpRequestedEventTOperationTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(
                () =>
                new ConstructorArgumentValidationTestScenario <ExecuteOpRequestedEvent <GetProtocolByTypeOp> >
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'operation' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <ExecuteOpRequestedEvent <GetProtocolByTypeOp> >();

                    var result = new ExecuteOpRequestedEvent <GetProtocolByTypeOp>(
                        null,
                        referenceObject.TimestampUtc,
                        referenceObject.Details);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[]
                {
                    "operation",
                },
            });
        }
        static SectionCellLocatorTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SectionCellLocator>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'cellId' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SectionCellLocator>();

                    var result = new SectionCellLocator(
                        null,
                        referenceObject.SlotId,
                        referenceObject.SlotSelectionStrategy);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "cellId", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SectionCellLocator>
            {
                Name             = "constructor should throw ArgumentException when parameter 'cellId' is white space scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SectionCellLocator>();

                    var result = new SectionCellLocator(
                        Invariant($"  {Environment.NewLine}  "),
                        referenceObject.SlotId,
                        referenceObject.SlotSelectionStrategy);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "cellId", "white space", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SectionCellLocator>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'slotSelectionStrategy' is SlotSelectionStrategy.Unknown",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SectionCellLocator>();

                    var result = new SectionCellLocator(
                        referenceObject.CellId,
                        referenceObject.SlotId,
                        SlotSelectionStrategy.Unknown);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "slotSelectionStrategy", "Unknown", },
            });
        }
Exemple #5
0
        static MediaReferenceTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <MediaReference>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'url' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <MediaReference>();

                    var result = new MediaReference(
                        null,
                        referenceObject.MediaReferenceKind,
                        referenceObject.Name);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "url", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <MediaReference>
            {
                Name             = "constructor should throw ArgumentException when parameter 'url' is white space scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <MediaReference>();

                    var result = new MediaReference(
                        Invariant($"  {Environment.NewLine}  "),
                        referenceObject.MediaReferenceKind,
                        referenceObject.Name);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "url", "white space", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <MediaReference>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'mediaReferenceKind' is Unknown",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <MediaReference>();

                    var result = new MediaReference(
                        referenceObject.Url,
                        MediaReferenceKind.Unknown,
                        referenceObject.Name);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "mediaReferenceKind", "Unknown", },
            });
        }
Exemple #6
0
        static TableColumnsTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <TableColumns>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'columns' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <TableColumns>();

                    var result = new TableColumns(
                        null,
                        referenceObject.ColumnsFormat);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "columns", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <TableColumns>
            {
                Name             = "constructor should throw ArgumentException when parameter 'columns' is an empty enumerable scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <TableColumns>();

                    var result = new TableColumns(
                        new List <Column>(),
                        referenceObject.ColumnsFormat);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "columns", "is an empty enumerable", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <TableColumns>
            {
                Name             = "constructor should throw ArgumentException when parameter 'columns' contains a null element scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <TableColumns>();

                    var result = new TableColumns(
                        new Column[0].Concat(referenceObject.Columns).Concat(new Column[] { null }).Concat(referenceObject.Columns).ToList(),
                        referenceObject.ColumnsFormat);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "columns", "contains at least one null element", },
            });
        }
        static InnerBorderTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <InnerBorder>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'weight' is BorderWeight.Unknown",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <InnerBorder>();

                    var result = new InnerBorder(BorderWeight.Unknown, referenceObject.Style, referenceObject.Color, referenceObject.Edges);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "weight", "Unknown", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <InnerBorder>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'style' is BorderStyle.Unknown",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <InnerBorder>();

                    var result = new InnerBorder(referenceObject.Weight, BorderStyle.Unknown, referenceObject.Color, referenceObject.Edges);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "style", "Unknown", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <InnerBorder>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'edges' is InnerBorderEdges.None",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <InnerBorder>();

                    var result = new InnerBorder(referenceObject.Weight, referenceObject.Style, referenceObject.Color, InnerBorderEdges.None);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "edges", "None", },
            });
        }
Exemple #8
0
        static DecimalSqlDataTypeRepresentationTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <DecimalSqlDataTypeRepresentation>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'precision' is 0",
                ConstructionFunc = () =>
                {
                    var result = new DecimalSqlDataTypeRepresentation(0);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "precision", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <DecimalSqlDataTypeRepresentation>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'precision' is greater than 38",
                ConstructionFunc = () =>
                {
                    var result = new DecimalSqlDataTypeRepresentation(A.Dummy <byte>().ThatIs(_ => _ > 38));

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "precision", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <DecimalSqlDataTypeRepresentation>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'scale' is greater than parameter 'precision'",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <DecimalSqlDataTypeRepresentation>();

                    var result = new DecimalSqlDataTypeRepresentation(referenceObject.Precision, A.Dummy <byte>().ThatIs(_ => _ > referenceObject.Precision));

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "scale", },
            });
        }
        static BinarySqlDataTypeRepresentationTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <BinarySqlDataTypeRepresentation>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'supportedLength' is 0",
                ConstructionFunc = () =>
                {
                    var result = new BinarySqlDataTypeRepresentation(0);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "supportedLength", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <BinarySqlDataTypeRepresentation>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'supportedLength' is negative",
                ConstructionFunc = () =>
                {
                    var result = new BinarySqlDataTypeRepresentation(A.Dummy <NegativeInteger>());

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "supportedLength", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <BinarySqlDataTypeRepresentation>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'supportedLength' is > MaxLengthConstant",
                ConstructionFunc = () =>
                {
                    var result = new BinarySqlDataTypeRepresentation(BinarySqlDataTypeRepresentation.MaxLengthConstant + 1);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "supportedLength", },
            });
        }
        static EmailAttachmentTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <EmailAttachment>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'fileBytes' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <EmailAttachment>();

                    var result = new EmailAttachment(
                        null,
                        referenceObject.FileName,
                        referenceObject.MediaType,
                        referenceObject.FileNameEncodingKind);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "fileBytes", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <EmailAttachment>
            {
                Name             = "constructor should throw ArgumentException when parameter 'fileBytes' is an empty enumerable scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <EmailAttachment>();

                    var result = new EmailAttachment(
                        new byte[0],
                        referenceObject.FileName,
                        referenceObject.MediaType,
                        referenceObject.FileNameEncodingKind);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "fileBytes", "is an empty enumerable", },
            });
        }
        static FillPatternTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <FillPattern>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'style' is FillPatternStyle.Unknown",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <FillPattern>();

                    var result = new FillPattern(FillPatternStyle.Unknown, referenceObject.Color);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "style", "Unknown", },
            });
        }
Exemple #12
0
        static GetAudienceResultTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <GetAudienceResult>
            {
                Name             = "constructor should throw ArgumentException when parameter 'failures' is not null and contains a null element scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <GetAudienceResult>();

                    var result = new GetAudienceResult(
                        referenceObject.Audience,
                        new[] { A.Dummy <IFailure>(), null, A.Dummy <IFailure>() },
                        referenceObject.FailureAction);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "failures", "contains at least one null element", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <GetAudienceResult>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'failureAction' is FailureAction.Unknown",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <GetAudienceResult>();

                    var result = new GetAudienceResult(
                        referenceObject.Audience,
                        referenceObject.Failures,
                        FailureAction.Unknown);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "failureAction", "Unknown", },
            });
        }
Exemple #13
0
        static FileTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <File>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'bytes' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <File>();

                    var result = new File(
                        null,
                        referenceObject.FileName,
                        referenceObject.FileFormat);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "bytes", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <File>
            {
                Name             = "constructor should throw ArgumentException when parameter 'bytes' is an empty enumerable scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <File>();

                    var result = new File(
                        new byte[0],
                        referenceObject.FileName,
                        referenceObject.FileFormat);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "bytes", "is an empty enumerable", },
            });
        }
        static ChannelOperationInstructionTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <ChannelOperationInstruction>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'operation' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <ChannelOperationInstruction>();

                    var result = new ChannelOperationInstruction(
                        null,
                        referenceObject.MonitoringInfo,
                        referenceObject.Tags);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "operation", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <ChannelOperationInstruction>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'monitoringInfo' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <ChannelOperationInstruction>();

                    var result = new ChannelOperationInstruction(
                        referenceObject.Operation,
                        null,
                        referenceObject.Tags);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "monitoringInfo", },
            });
        }
        static SendEmailRequestTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SendEmailRequest>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'emailParticipants' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SendEmailRequest>();

                    var result = new SendEmailRequest(
                        null,
                        referenceObject.EmailContent,
                        referenceObject.EmailOptions);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "emailParticipants", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SendEmailRequest>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'emailContent' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SendEmailRequest>();

                    var result = new SendEmailRequest(
                        referenceObject.EmailParticipants,
                        null,
                        referenceObject.EmailOptions);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "emailContent", },
            });
        }
Exemple #16
0
        static ValidationTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <Validation>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'operation' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <Validation>();

                    var result = new Validation(
                        null,
                        referenceObject.MessageFormatKind,
                        referenceObject.Details);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "operation", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <Validation>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'messageFormatKind' is MessageFormatKind.Unknown scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <Validation>();

                    var result = new Validation(
                        referenceObject.Operation,
                        MessageFormatKind.Unknown,
                        referenceObject.Details);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "messageFormatKind", "Unknown" },
            });
        }
Exemple #17
0
        static StringDescribedSerializationTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <StringDescribedSerialization>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'payloadTypeRepresentation' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <StringDescribedSerialization>();

                    var result = new StringDescribedSerialization(
                        null,
                        referenceObject.SerializerRepresentation,
                        referenceObject.SerializedPayload);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "payloadTypeRepresentation" },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <StringDescribedSerialization>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'serializerRepresentation' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <StringDescribedSerialization>();

                    var result = new StringDescribedSerialization(
                        referenceObject.PayloadTypeRepresentation,
                        null,
                        referenceObject.SerializedPayload);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "serializerRepresentation" },
            });
        }
 static FiftyTwoFiftyThreeWeekAccountingPeriodSystemTest()
 {
     ConstructorArgumentValidationTestScenarios
     .RemoveAllScenarios()
     .AddScenario(() =>
                  new ConstructorArgumentValidationTestScenario <FiftyTwoFiftyThreeWeekAccountingPeriodSystem>
     {
         Name             = "Constructor should throw ArgumentOutOfRangeException when parameter 'anchorMonth' is MonthOfYear.Invalid",
         ConstructionFunc = () => new FiftyTwoFiftyThreeWeekAccountingPeriodSystem(A.Dummy <DayOfWeek>(), MonthOfYear.Invalid, A.Dummy <FiftyTwoFiftyThreeWeekMethodology>()),
         ExpectedExceptionMessageContains = new[] { "anchorMonth", "Invalid" },
         ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
     })
     .AddScenario(() =>
                  new ConstructorArgumentValidationTestScenario <FiftyTwoFiftyThreeWeekAccountingPeriodSystem>
     {
         Name             = "Constructor should throw ArgumentOutOfRangeException when parameter 'fiftyTwoFiftyThreeWeekMethodology' is FiftyTwoFiftyThreeWeekMethodology.Unknown",
         ConstructionFunc = () => new FiftyTwoFiftyThreeWeekAccountingPeriodSystem(A.Dummy <DayOfWeek>(), A.Dummy <MonthOfYear>(), FiftyTwoFiftyThreeWeekMethodology.Unknown),
         ExpectedExceptionMessageContains = new[] { "fiftyTwoFiftyThreeWeekMethodology", "Unknown" },
         ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
     });
 }
Exemple #19
0
 static FiscalYearAccountingPeriodSystemTest()
 {
     ConstructorArgumentValidationTestScenarios
     .RemoveAllScenarios()
     .AddScenario(() =>
                  new ConstructorArgumentValidationTestScenario <FiscalYearAccountingPeriodSystem>
     {
         Name             = "Constructor should throw ArgumentOutOfRangeException when parameter 'lastMonthInFiscalYear' is MonthOfYear.Invalid",
         ConstructionFunc = () => new FiscalYearAccountingPeriodSystem(MonthOfYear.Invalid),
         ExpectedExceptionMessageContains = new[] { "lastMonthInFiscalYear", "Invalid" },
         ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
     })
     .AddScenario(() =>
                  new ConstructorArgumentValidationTestScenario <FiscalYearAccountingPeriodSystem>
     {
         Name             = "Constructor should throw ArgumentOutOfRangeException when parameter 'lastMonthInFiscalYear' is MonthOfYear.December",
         ConstructionFunc = () => new FiscalYearAccountingPeriodSystem(MonthOfYear.December),
         ExpectedExceptionMessageContains = new[] { "lastMonthInFiscalYear", "December" },
         ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
     });
 }
Exemple #20
0
        static AvailabilityCheckResultTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <AvailabilityCheckResult>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'availabilityOp' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <AvailabilityCheckResult>();

                    var result = new AvailabilityCheckResult(
                        null,
                        referenceObject.MessageOp);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "availabilityOp", },
            });
        }
Exemple #21
0
        static ColumnTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <Column>
            {
                Name             = "constructor should throw ArgumentException when parameter 'id' is white space scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <Column>();

                    var result = new Column(
                        Invariant($"  {Environment.NewLine}  "),
                        referenceObject.Format);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "id", "white space", },
            });
        }
Exemple #22
0
        static EmailMailboxTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <EmailMailbox>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'address' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <EmailMailbox>();

                    var result = new EmailMailbox(
                        null,
                        referenceObject.Name);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "address", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <EmailMailbox>
            {
                Name             = "constructor should throw ArgumentException when parameter 'address' is white space scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <EmailMailbox>();

                    var result = new EmailMailbox(
                        Invariant($"  {Environment.NewLine}  "),
                        referenceObject.Name);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "address", "white space", },
            });
        }
Exemple #23
0
        static FooterRowsTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <FooterRows>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'rows' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <FooterRows>();

                    var result = new FooterRows(
                        null,
                        referenceObject.Format);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "rows", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <FooterRows>
            {
                Name             = "constructor should throw ArgumentException when parameter 'rows' contains a null element scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <FooterRows>();

                    var result = new FooterRows(
                        new FlatRow[0].Concat(referenceObject.Rows).Concat(new FlatRow[] { null }).Concat(referenceObject.Rows).ToList(),
                        referenceObject.Format);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "rows", "contains at least one null element", },
            });
        }
Exemple #24
0
        static DateTimeCellValueFormatTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <DateTimeCellValueFormat>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'format' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <DateTimeCellValueFormat>();

                    var result = new DateTimeCellValueFormat(
                        null,
                        referenceObject.MissingValueText);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "format", },
            });
        }
Exemple #25
0
        static DatapointTTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <Datapoint <Version> >
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'reportingPeriod' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <Datapoint <Version> >();

                    var result = new Datapoint <Version>(
                        null,
                        referenceObject.Value);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "reportingPeriod", },
            });
        }
        static GetCellValueOpTResultTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <GetCellValueOp <Version> >
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'cellLocator' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <GetCellValueOp <Version> >();

                    var result = new GetCellValueOp <Version>(
                        null,
                        referenceObject.DefaultValue);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "cellLocator", },
            });
        }
Exemple #27
0
        static NamedValueTValueTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <NamedValue <Version> >
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'name' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <NamedValue <Version> >();

                    var result = new NamedValue <Version>(
                        null,
                        referenceObject.Value);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "name", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <NamedValue <Version> >
            {
                Name             = "constructor should throw ArgumentException when parameter 'name' is white space scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <NamedValue <Version> >();

                    var result = new NamedValue <Version>(
                        Invariant($"  {Environment.NewLine}  "),
                        referenceObject.Value);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "name", "white space", },
            });
        }
        static SqlOutputParameterResultTValueTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SqlOutputParameterResult <Version> >
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'outputParameter' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SqlOutputParameterResult <Version> >();

                    var result = new SqlOutputParameterResult <Version>(
                        null,
                        referenceObject.Value);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "outputParameter", },
            });
        }
        static SucceededInSendingEmailEventTIdTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SucceededInSendingEmailEvent <Version> >
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'sendEmailResponse' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SucceededInSendingEmailEvent <Version> >();

                    var result = new SucceededInSendingEmailEvent <Version>(
                        referenceObject.Id,
                        referenceObject.TimestampUtc,
                        null);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "sendEmailResponse", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SucceededInSendingEmailEvent <Version> >
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when sendEmailResponse.SendEmailResult != SendEmailRequest.Success scenario",
                ConstructionFunc = () =>
                {
                    var emailFailedToSendEvent = A.Dummy <FailedToSendEmailEvent <Version> >();

                    var result = new SucceededInSendingEmailEvent <Version>(emailFailedToSendEvent.Id, emailFailedToSendEvent.TimestampUtc, emailFailedToSendEvent.SendEmailResponse);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "sendEmailResponse.SendEmailResult", "Success" },
            });
        }
Exemple #30
0
        static ConstantExpressionRepresentationTTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <ConstantExpressionRepresentation <Version> >
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'type' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <ConstantExpressionRepresentation <Version> >();

                    var result = new ConstantExpressionRepresentation <Version>(
                        null,
                        referenceObject.NodeType,
                        referenceObject.Value);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "type" },
            });
        }