public void Create_HasCalculationOutputWithBlocksAndColumns_EntityHasOrderedCalculationOutputEntity() { // Setup var registry = new PersistenceRegistry(); var calculation = new StabilityStoneCoverWaveConditionsCalculation { Output = StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithColumnsAndBlocks(new[] { new TestWaveConditionsOutput() }, new[] { 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.AreEqual(Convert.ToByte(StabilityStoneCoverWaveConditionsOutputType.Blocks), outputEntities.ElementAt(0).OutputType); Assert.AreEqual(Convert.ToByte(StabilityStoneCoverWaveConditionsOutputType.Columns), outputEntities.ElementAt(1).OutputType); }
public void CreateOutputWithColumnsAndBlocks_BlocksNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithColumnsAndBlocks(Enumerable.Empty <WaveConditionsOutput>(), null); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("blocks", exception.ParamName); }
public void CreateOutputWithColumnsAndBlocks_WithOutput_ReturnsOutput() { // Setup IEnumerable <WaveConditionsOutput> columnsOutput = Enumerable.Empty <WaveConditionsOutput>(); IEnumerable <WaveConditionsOutput> blocksOutput = Enumerable.Empty <WaveConditionsOutput>(); // Call StabilityStoneCoverWaveConditionsOutput output = StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithColumnsAndBlocks(columnsOutput, blocksOutput); // Assert Assert.AreSame(columnsOutput, output.ColumnsOutput); Assert.AreSame(blocksOutput, output.BlocksOutput); }
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)); }
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)); }