public void Create_HasCalculationOutputWithColumns_EntityHasOrderedCalculationOutputEntity()
        {
            // Setup
            var registry    = new PersistenceRegistry();
            var calculation = new StabilityStoneCoverWaveConditionsCalculation
            {
                Output = StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithColumns(new[]
                {
                    new TestWaveConditionsOutput(),
                    new TestWaveConditionsOutput()
                })
            };

            // Call
            StabilityStoneCoverWaveConditionsCalculationEntity entity = calculation.Create(registry, 0);

            // Assert
            ICollection <StabilityStoneCoverWaveConditionsOutputEntity> outputEntities = entity.StabilityStoneCoverWaveConditionsOutputEntities;

            Assert.AreEqual(2, outputEntities.Count);
            CollectionAssert.AreEqual(new[]
            {
                0,
                1
            }, outputEntities.Select(oe => oe.Order));

            Assert.IsTrue(outputEntities.All(o => o.OutputType == Convert.ToByte(StabilityStoneCoverWaveConditionsOutputType.Columns)));
        }
Example #2
0
        public void CreateOutputWithColumns_ColumnsNull_ThrowsArgumentNullException()
        {
            // Call
            TestDelegate call = () => StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithColumns(null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(call);

            Assert.AreEqual("columns", exception.ParamName);
        }
Example #3
0
        public void CreateOutputWithColumns_WithColumnsOutput_ReturnsOutput()
        {
            // Setup
            IEnumerable <WaveConditionsOutput> columnsOutput = Enumerable.Empty <WaveConditionsOutput>();

            // Call
            StabilityStoneCoverWaveConditionsOutput output = StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithColumns(columnsOutput);

            // Assert
            Assert.AreSame(columnsOutput, output.ColumnsOutput);
            Assert.IsNull(output.BlocksOutput);
        }
Example #4
0
        private static StabilityStoneCoverWaveConditionsOutput CreateStabilityStoneCoverWaveConditionsOutput(IEnumerable <WaveConditionsOutput> columnsOutput,
                                                                                                             IEnumerable <WaveConditionsOutput> blocksOutput)
        {
            if (!columnsOutput.Any())
            {
                return(StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithBlocks(blocksOutput));
            }

            if (!blocksOutput.Any())
            {
                return(StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithColumns(columnsOutput));
            }

            return(StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithColumnsAndBlocks(columnsOutput, blocksOutput));
        }
Example #5
0
        private static StabilityStoneCoverWaveConditionsOutput CreateOutput(StabilityStoneCoverWaveConditionsCalculationType calculationType,
                                                                            IEnumerable <WaveConditionsOutput> blocksOutputs,
                                                                            IEnumerable <WaveConditionsOutput> columnsOutputs)
        {
            if (calculationType == StabilityStoneCoverWaveConditionsCalculationType.Blocks)
            {
                return(StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithBlocks(blocksOutputs));
            }

            if (calculationType == StabilityStoneCoverWaveConditionsCalculationType.Columns)
            {
                return(StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithColumns(columnsOutputs));
            }

            return(StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithColumnsAndBlocks(columnsOutputs, blocksOutputs));
        }