public void Create_HasCalculationOutputWithBlocks_EntityHasOrderedCalculationOutputEntity() { // Setup var registry = new PersistenceRegistry(); var calculation = new StabilityStoneCoverWaveConditionsCalculation { Output = StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithBlocks(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.Blocks))); }
public void CreateOutputWithBlocks_BlocksNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithBlocks(null); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("blocks", exception.ParamName); }
public void CreateOutputWithBlocks_WithBlocksOutput_ReturnsOutput() { // Setup IEnumerable <WaveConditionsOutput> blocksOutput = Enumerable.Empty <WaveConditionsOutput>(); // Call StabilityStoneCoverWaveConditionsOutput output = StabilityStoneCoverWaveConditionsOutputFactory.CreateOutputWithBlocks(blocksOutput); // Assert Assert.AreSame(blocksOutput, output.BlocksOutput); Assert.IsNull(output.ColumnsOutput); }
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)); }