private static CellBase InternalDeepCloneWithColumnsSpanned(
            CellBase cell,
            int columnsSpanned)
        {
            CellBase result;

            if (cell is SlottedCell slottedCell)
            {
                result = new SlottedCell(
                    slottedCell.SlotIdToCellMap.ToDictionary(_ => _.Key, _ => (INotSlottedCell)((NotSlottedCellBase)_.Value).DeepCloneWithColumnsSpanned(columnsSpanned)),
                    slottedCell.DefaultSlotId,
                    slottedCell.Id,
                    columnsSpanned,
                    slottedCell.Details);
            }
            else
            {
                result = cell.DeepCloneWithColumnsSpanned(columnsSpanned);
            }

            return(result);
        }
        public DataStructureDummyFactory()
        {
            // <------------------- ENUMS ------------------------>
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(Availability.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(AvailabilityCheckStatus.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(AvailabilityCheckStepAction.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(BorderStyle.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(BorderWeight.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(BytesPayloadLinkedResourceKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(CellOpExecutionOutcome.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(CellOpExecutionStatus.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(CompareOperator.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(FillPatternStyle.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(HorizontalAlignment.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(InnerBorderEdges.None);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(LinkTarget.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(MediaReferenceKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(MessageFormatKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(NumberFormatDigitGroupKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(NumberFormatNegativeDisplayKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(NumberFormatPercentDisplayKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(OuterBorderSides.None);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(SlotSelectionStrategy.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(StringPayloadLinkedResourceKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(UrlLinkedResourceKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(ValidationStatus.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(ValidationStepAction.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(Validity.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(VerticalAlignment.Unknown);

            // <------------------- INTERFACES ------------------------>
            AutoFixtureBackedDummyFactory.AddDummyCreator <IAvailabilityCheckCell>(A.Dummy <NotSlottedCellBase>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <ICell>(A.Dummy <CellBase>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <INotSlottedCell>(A.Dummy <NotSlottedCellBase>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <IValidationCell>(A.Dummy <NotSlottedCellBase>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <ICellValueFormat <Version> >(A.Dummy <CellValueFormatBase <Version> >);
            AutoFixtureBackedDummyFactory.AddDummyCreator <IHoverOver>(A.Dummy <HoverOverBase>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <ILink>(A.Dummy <SimpleLink>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <ILinkedResource>(A.Dummy <LinkedResourceBase>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <IOperationOutputCell <Version> >(A.Dummy <OperationCell <Version> >);

            // <------------------- OPERATIONS ------------------------>
            RegisterReturningOperation <bool>();
            RegisterReturningOperation <decimal>();
            RegisterReturningOperation <string>();
            RegisterReturningOperation <ValidationResult>();
            RegisterReturningOperation <AvailabilityCheckResult>();
            RegisterReturningOperation <Availability>();
            RegisterReturningOperation <Validity>();
            RegisterReturningOperation <CellLocatorBase>();
            RegisterReturningOperation <CompareOperator>();

            // <------------------- MODELS ------------------------>

            // Report
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var numberOfSections = ThreadSafeRandom.Next(1, 4);

                var result = new Report(A.Dummy <string>(), Some.ReadOnlyDummies <Section>(numberOfSections).ToList(), A.Dummy <string>(), A.Dummy <UtcDateTime>(), Some.ReadOnlyDummies <SimpleLink>().ToList(), A.Dummy <AdditionalReportInfo>(), A.Dummy <ReportFormat>());

                return(result);
            });

            // TreeTable
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var numberOfColumns = GetRandomNumberOfColumns();

                var columns = Some.ReadOnlyDummies <Column>(numberOfColumns).ToList();

                var tableColumns = new TableColumns(columns, A.Dummy <ColumnFormat>());

                var tableRows = BuildTableRows(columns.Count);

                var result = new TreeTable(tableColumns, tableRows, A.Dummy <TableFormat>());

                return(result);
            });

            // TableRows
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = BuildTableRows(GetRandomNumberOfColumns());

                return(result);
            });

            // HeaderRows
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var headerRows = BuildFlatRows(GetRandomNumberOfColumns());

                var result = new HeaderRows(headerRows, A.Dummy <HeaderRowsFormat>());

                return(result);
            });

            // DataRows
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var allDataRows = BuildDataRows(GetRandomNumberOfColumns());

                var result = new DataRows(allDataRows, A.Dummy <DataRowsFormat>());

                return(result);
            });

            // FooterRows
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var footerRows = BuildFlatRows(GetRandomNumberOfColumns());

                var result = new FooterRows(footerRows, A.Dummy <FooterRowsFormat>());

                return(result);
            });

            // Row
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = BuildDataRow(GetRandomNumberOfColumns());

                return(result);
            });

            // FlatRow
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = BuildFlatRow(GetRandomNumberOfColumns(), allowSpanningCells: true);

                return(result);
            });

            // SlottedCell
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var columnsSpanned = GetRandomColumnsSpannedByCell();

                var cells = Some.ReadOnlyDummies <NotSlottedCellBase>().Select(_ => _.DeepCloneWithColumnsSpanned(columnsSpanned)).Cast <NotSlottedCellBase>().ToList();

                var slotIdToCellMap = cells.ToDictionary(_ => A.Dummy <string>(), _ => (INotSlottedCell)_);

                var defaultSlotId = slotIdToCellMap.ElementAt(ThreadSafeRandom.Next(0, slotIdToCellMap.Count)).Key;

                var result = new SlottedCell(slotIdToCellMap, defaultSlotId, A.Dummy <string>(), columnsSpanned, A.Dummy <string>());

                return(result);
            });

            // InputCell<Version>
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new InputCell <Version>(
                    A.Dummy <string>(),
                    GetRandomColumnsSpannedByCell(),
                    A.Dummy <string>(),
                    A.Dummy <Validation>(),
                    Some.ReadOnlyDummies <CellValidationEventBase>().ToList(),
                    A.Dummy <Availability>(),
                    A.Dummy <AvailabilityCheck>(),
                    Some.ReadOnlyDummies <CellAvailabilityCheckEventBase>().ToList(),
                    Some.ReadOnlyDummies <CellInputEventBase>().ToList(),
                    A.Dummy <ICellValueFormat <Version> >(),
                    A.Dummy <CellFormat>(), A.Dummy <IHoverOver>());

                return(result);
            });

            // NullCell
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new NullCell(
                    A.Dummy <string>(),
                    GetRandomColumnsSpannedByCell(),
                    A.Dummy <string>(),
                    A.Dummy <Validation>(),
                    Some.ReadOnlyDummies <CellValidationEventBase>().ToList(),
                    A.Dummy <Availability>(),
                    A.Dummy <AvailabilityCheck>(),
                    Some.ReadOnlyDummies <CellAvailabilityCheckEventBase>().ToList(),
                    A.Dummy <CellFormat>(),
                    A.Dummy <IHoverOver>(),
                    A.Dummy <ILink>());

                return(result);
            });

            // ConstCell<Version>
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new ConstCell <Version>(
                    A.Dummy <Version>(),
                    A.Dummy <string>(),
                    GetRandomColumnsSpannedByCell(),
                    A.Dummy <string>(),
                    A.Dummy <Validation>(),
                    Some.ReadOnlyDummies <CellValidationEventBase>().ToList(),
                    A.Dummy <Availability>(),
                    A.Dummy <AvailabilityCheck>(),
                    Some.ReadOnlyDummies <CellAvailabilityCheckEventBase>().ToList(),
                    A.Dummy <ICellValueFormat <Version> >(),
                    A.Dummy <CellFormat>(),
                    A.Dummy <IHoverOver>(),
                    A.Dummy <ILink>());

                return(result);
            });

            // OperationOutputCell<Version>
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new OperationCell <Version>(
                    A.Dummy <IReturningOperation <Version> >(),
                    A.Dummy <string>(),
                    GetRandomColumnsSpannedByCell(),
                    A.Dummy <string>(),
                    A.Dummy <Validation>(),
                    Some.ReadOnlyDummies <CellValidationEventBase>().ToList(),
                    A.Dummy <Availability>(),
                    A.Dummy <AvailabilityCheck>(),
                    Some.ReadOnlyDummies <CellAvailabilityCheckEventBase>().ToList(),
                    Some.ReadOnlyDummies <CellOpExecutionEventBase>().ToList(),
                    A.Dummy <ICellValueFormat <Version> >(),
                    A.Dummy <CellFormat>(),
                    A.Dummy <IHoverOver>(),
                    A.Dummy <ILink>());

                return(result);
            });

            // DateTimeFormat
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var localize = A.Dummy <bool>();

                var result = new DateTimeFormat(A.Dummy <DateTimeFormatKind>(), A.Dummy <CultureKind>(), localize, localize ? A.Dummy <StandardTimeZone>() : (StandardTimeZone?)null);

                return(result);
            });

            // ReportFormat
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var displayTimestamp = A.Dummy <bool>();

                var result = new ReportFormat(displayTimestamp, displayTimestamp ? A.Dummy <DateTimeFormat>() : null, A.Dummy <ReportFormatOptions>());

                return(result);
            });

            // Color
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = Color.FromArgb(A.Dummy <byte>(), A.Dummy <byte>(), A.Dummy <byte>());

                return(result);
            });

            // Events
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellAvailabilityCheckClearedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellAvailabilityCheckDeterminedCellDisabledEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellAvailabilityCheckDeterminedCellEnabledEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellAvailabilityCheckFailedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellInputAppliedEvent <Version>(A.Dummy <UtcDateTime>(), A.Dummy <Version>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellInputClearedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellOpExecutionAbortedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellOpExecutionClearedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellOpExecutionCompletedEvent <Version>(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <Version>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellOpExecutionDeemedNotApplicableEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellOpExecutionFailedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellValidationAbortedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellValidationClearedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellValidationDeemedNotApplicableEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellValidationDeterminedCellInvalidEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellValidationDeterminedCellValidEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellValidationFailedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });
        }
Ejemplo n.º 3
0
        static SlottedCellTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SlottedCell>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'slotIdToCellMap' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SlottedCell>();

                    var result = new SlottedCell(
                        null,
                        referenceObject.DefaultSlotId,
                        referenceObject.Id,
                        referenceObject.ColumnsSpanned,
                        referenceObject.Details);

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

                    var result = new SlottedCell(
                        new Dictionary <string, INotSlottedCell>(),
                        referenceObject.DefaultSlotId,
                        referenceObject.Id,
                        referenceObject.ColumnsSpanned,
                        referenceObject.Details);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "slotIdToCellMap", "is an empty dictionary", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SlottedCell>
            {
                Name             = "constructor should throw ArgumentException when parameter 'slotIdToCellMap' contains a key-value pair with a null value scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SlottedCell>();

                    var dictionaryWithNullValue = referenceObject.SlotIdToCellMap.ToDictionary(_ => _.Key, _ => _.Value);

                    var randomKey = dictionaryWithNullValue.Keys.ElementAt(ThreadSafeRandom.Next(0, dictionaryWithNullValue.Count));

                    dictionaryWithNullValue[randomKey] = null;

                    var result = new SlottedCell(
                        dictionaryWithNullValue,
                        referenceObject.DefaultSlotId,
                        referenceObject.Id,
                        referenceObject.ColumnsSpanned,
                        referenceObject.Details);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "slotIdToCellMap", "contains at least one key-value pair with a null value", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SlottedCell>
            {
                Name             = "constructor should throw ArgumentException when parameter 'slotIdToCellMap' contains a white space key",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SlottedCell>();

                    var slotIdToCellMap = referenceObject.SlotIdToCellMap.ToDictionary(_ => _.Key, _ => _.Value);

                    slotIdToCellMap.Add(" \r\n ", A.Dummy <INotSlottedCell>());

                    var result = new SlottedCell(
                        slotIdToCellMap,
                        referenceObject.DefaultSlotId,
                        referenceObject.Id,
                        referenceObject.ColumnsSpanned,
                        referenceObject.Details);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "slotIdToCellMap", "contains at least one key-value pair with a white space key" },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SlottedCell>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'defaultSlotId' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SlottedCell>();

                    var result = new SlottedCell(
                        referenceObject.SlotIdToCellMap,
                        null,
                        referenceObject.Id,
                        referenceObject.ColumnsSpanned,
                        referenceObject.Details);

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

                    var result = new SlottedCell(
                        referenceObject.SlotIdToCellMap,
                        Invariant($"  {Environment.NewLine}  "),
                        referenceObject.Id,
                        referenceObject.ColumnsSpanned,
                        referenceObject.Details);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "defaultSlotId", "white space", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SlottedCell>
            {
                Name             = "constructor should throw ArgumentException when parameter 'slotIdToCellMap' does not contain the specified defaultSlotId",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SlottedCell>();

                    var result = new SlottedCell(
                        referenceObject.SlotIdToCellMap,
                        A.Dummy <string>(),
                        referenceObject.Id,
                        referenceObject.ColumnsSpanned,
                        referenceObject.Details);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "slotIdToCellMap does not contain the specified defaultSlotId" },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SlottedCell>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'columnsSpanned' is 0",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SlottedCell>();

                    var result = new SlottedCell(
                        referenceObject.SlotIdToCellMap,
                        referenceObject.DefaultSlotId,
                        referenceObject.Id,
                        0,
                        referenceObject.Details);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "columnsSpanned is 0; must be null or >= 1.", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SlottedCell>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'columnsSpanned' is -1",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SlottedCell>();

                    var result = new SlottedCell(
                        referenceObject.SlotIdToCellMap,
                        referenceObject.DefaultSlotId,
                        referenceObject.Id,
                        -1,
                        referenceObject.Details);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "columnsSpanned is -1; must be null or >= 1.", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SlottedCell>
            {
                Name             = "constructor should throw ArgumentOutOfRangeException when parameter 'columnsSpanned' is negative",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SlottedCell>();

                    var result = new SlottedCell(
                        referenceObject.SlotIdToCellMap,
                        referenceObject.DefaultSlotId,
                        referenceObject.Id,
                        A.Dummy <NegativeInteger>(),
                        referenceObject.Details);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentOutOfRangeException),
                ExpectedExceptionMessageContains = new[] { "must be null or >= 1.", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <SlottedCell>
            {
                Name             = "constructor should throw ArgumentException when parameter 'slotIdToCellMap' contains a value whose ColumnsSpanned does not equal columnsSpanned (with null imputed to 1)",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <SlottedCell>();

                    var slotIdToCellMap = new Dictionary <string, INotSlottedCell>
                    {
                        { A.Dummy <string>(), new NullCell(columnsSpanned: referenceObject.ColumnsSpanned) },
                        { A.Dummy <string>(), new NullCell(columnsSpanned: referenceObject.ColumnsSpanned == null ? 2 : referenceObject.ColumnsSpanned + 1) },
                        { A.Dummy <string>(), new NullCell(columnsSpanned: referenceObject.ColumnsSpanned) },
                    };

                    var result = new SlottedCell(
                        slotIdToCellMap,
                        slotIdToCellMap.Keys.First(),
                        referenceObject.Id,
                        referenceObject.ColumnsSpanned,
                        referenceObject.Details);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "slotIdToCellMap contains a cell that does not span the same number of columns as this cell." },
            });

            DeepCloneWithTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new DeepCloneWithTestScenario <SlottedCell>
            {
                Name             = "DeepCloneWithId should deep clone object and replace Id with the provided id",
                WithPropertyName = "Id",
                SystemUnderTestDeepCloneWithValueFunc = () =>
                {
                    var systemUnderTest = A.Dummy <SlottedCell>();

                    var referenceObject = A.Dummy <SlottedCell>().ThatIs(_ => !systemUnderTest.Id.IsEqualTo(_.Id));

                    var result = new SystemUnderTestDeepCloneWithValue <SlottedCell>
                    {
                        SystemUnderTest    = systemUnderTest,
                        DeepCloneWithValue = referenceObject.Id,
                    };

                    return(result);
                },
            })
            .AddScenario(() =>
                         new DeepCloneWithTestScenario <SlottedCell>
            {
                Name             = "DeepCloneWithColumnsSpanned should deep clone object and replace ColumnsSpanned with the provided columnsSpanned",
                WithPropertyName = "ColumnsSpanned",
                SystemUnderTestDeepCloneWithValueFunc = () =>
                {
                    var slotIdToCellMap = new Dictionary <string, INotSlottedCell>
                    {
                        { A.Dummy <string>(), new NullCell() },
                        { A.Dummy <string>(), new NullCell() },
                        { A.Dummy <string>(), new NullCell() },
                    };

                    var systemUnderTest = new SlottedCell(
                        slotIdToCellMap,
                        slotIdToCellMap.Keys.First());

                    var result = new SystemUnderTestDeepCloneWithValue <SlottedCell>
                    {
                        SystemUnderTest    = systemUnderTest,
                        DeepCloneWithValue = 1,
                    };

                    return(result);
                },
            })
            .AddScenario(() =>
                         new DeepCloneWithTestScenario <SlottedCell>
            {
                Name             = "DeepCloneWithDetails should deep clone object and replace Details with the provided details",
                WithPropertyName = "Details",
                SystemUnderTestDeepCloneWithValueFunc = () =>
                {
                    var systemUnderTest = A.Dummy <SlottedCell>();

                    var referenceObject = A.Dummy <SlottedCell>().ThatIs(_ => !systemUnderTest.Details.IsEqualTo(_.Details));

                    var result = new SystemUnderTestDeepCloneWithValue <SlottedCell>
                    {
                        SystemUnderTest    = systemUnderTest,
                        DeepCloneWithValue = referenceObject.Details,
                    };

                    return(result);
                },
            })
            .AddScenario(() =>
                         new DeepCloneWithTestScenario <SlottedCell>
            {
                Name             = "DeepCloneWithSlotIdToCellMap should deep clone object and replace SlotIdToCellMap with the provided slotIdToCellMap",
                WithPropertyName = "SlotIdToCellMap",
                SystemUnderTestDeepCloneWithValueFunc = () =>
                {
                    var slotIdToCellMap = new Dictionary <string, INotSlottedCell>
                    {
                        { "abc", new NullCell() },
                        { A.Dummy <string>(), new NullCell() },
                        { A.Dummy <string>(), new NullCell() },
                    };

                    var systemUnderTest = new SlottedCell(
                        slotIdToCellMap,
                        slotIdToCellMap.Keys.First());

                    var result = new SystemUnderTestDeepCloneWithValue <SlottedCell>
                    {
                        SystemUnderTest    = systemUnderTest,
                        DeepCloneWithValue = new Dictionary <string, INotSlottedCell>
                        {
                            { A.Dummy <string>(), new NullCell() },
                            { "abc", new NullCell() },
                            { A.Dummy <string>(), new NullCell() },
                        },
                    };

                    return(result);
                },
            })
            .AddScenario(() =>
                         new DeepCloneWithTestScenario <SlottedCell>
            {
                Name             = "DeepCloneWithDefaultSlotId should deep clone object and replace DefaultSlotId with the provided defaultSlotId",
                WithPropertyName = "DefaultSlotId",
                SystemUnderTestDeepCloneWithValueFunc = () =>
                {
                    var systemUnderTest = A.Dummy <SlottedCell>().Whose(_ => _.SlotIdToCellMap.Count() > 1);

                    var defaultSlotId = systemUnderTest.SlotIdToCellMap.Keys.First(_ => _ != systemUnderTest.DefaultSlotId);

                    var result = new SystemUnderTestDeepCloneWithValue <SlottedCell>
                    {
                        SystemUnderTest    = systemUnderTest,
                        DeepCloneWithValue = defaultSlotId,
                    };

                    return(result);
                },
            });

            EquatableTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
            {
                var referenceObjectForEquatableTestScenarios = new SlottedCell(
                    new Dictionary <string, INotSlottedCell>
                {
                    { "abc", new NullCell(columnsSpanned: 1) },
                    { "def", new NullCell(columnsSpanned: 1) },
                    { "ghi", new NullCell(columnsSpanned: 1) },
                },
                    "def",
                    A.Dummy <string>(),
                    1,
                    A.Dummy <string>());

                return(new EquatableTestScenario <SlottedCell>
                {
                    Name = "Default Code Generated Scenario",
                    ReferenceObject = referenceObjectForEquatableTestScenarios,
                    ObjectsThatAreEqualToButNotTheSameAsReferenceObject = new SlottedCell[]
                    {
                        new SlottedCell(
                            referenceObjectForEquatableTestScenarios.SlotIdToCellMap,
                            referenceObjectForEquatableTestScenarios.DefaultSlotId,
                            referenceObjectForEquatableTestScenarios.Id,
                            referenceObjectForEquatableTestScenarios.ColumnsSpanned,
                            referenceObjectForEquatableTestScenarios.Details),
                    },
                    ObjectsThatAreNotEqualToReferenceObject = new SlottedCell[]
                    {
                        new SlottedCell(
                            referenceObjectForEquatableTestScenarios.SlotIdToCellMap,
                            referenceObjectForEquatableTestScenarios.DefaultSlotId,
                            A.Dummy <SlottedCell>().Whose(_ => !_.Id.IsEqualTo(referenceObjectForEquatableTestScenarios.Id)).Id,
                            referenceObjectForEquatableTestScenarios.ColumnsSpanned,
                            referenceObjectForEquatableTestScenarios.Details),
                        new SlottedCell(
                            referenceObjectForEquatableTestScenarios.SlotIdToCellMap,
                            referenceObjectForEquatableTestScenarios.DefaultSlotId,
                            referenceObjectForEquatableTestScenarios.Id,
                            referenceObjectForEquatableTestScenarios.ColumnsSpanned,
                            A.Dummy <SlottedCell>().Whose(_ => !_.Details.IsEqualTo(referenceObjectForEquatableTestScenarios.Details)).Details),
                        new SlottedCell(
                            referenceObjectForEquatableTestScenarios.SlotIdToCellMap,
                            referenceObjectForEquatableTestScenarios.DefaultSlotId,
                            referenceObjectForEquatableTestScenarios.Id,
                            null,
                            referenceObjectForEquatableTestScenarios.Details),
                        new SlottedCell(
                            new Dictionary <string, INotSlottedCell>
                        {
                            { "abc", new NullCell(columnsSpanned: 1) },
                            { "def", new NullCell(columnsSpanned: 1) },
                        },
                            referenceObjectForEquatableTestScenarios.DefaultSlotId,
                            referenceObjectForEquatableTestScenarios.Id,
                            referenceObjectForEquatableTestScenarios.ColumnsSpanned,
                            referenceObjectForEquatableTestScenarios.Details),
                        new SlottedCell(
                            referenceObjectForEquatableTestScenarios.SlotIdToCellMap,
                            "abc",
                            referenceObjectForEquatableTestScenarios.Id,
                            referenceObjectForEquatableTestScenarios.ColumnsSpanned,
                            referenceObjectForEquatableTestScenarios.Details),
                    },
                    ObjectsThatAreNotOfTheSameTypeAsReferenceObject = new object[]
                    {
                        A.Dummy <object>(),
                        A.Dummy <string>(),
                        A.Dummy <int>(),
                        A.Dummy <int?>(),
                        A.Dummy <Guid>(),
                        A.Dummy <ConstCell <Version> >(),
                        A.Dummy <InputCell <Version> >(),
                        A.Dummy <NullCell>(),
                        A.Dummy <OperationCell <Version> >(),
                    },
                });
            });
        }