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))); }
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 CreateOutputWithColumns_ColumnsNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithColumns(null); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("columns", exception.ParamName); }
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); }
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)); }