/// <summary> /// Determines whether the specified operation terminates successfully as expected. /// </summary> /// <param name="operation">The operation.</param> public static void Succeed( AlongDimensionExtremumOperation <IndexValuePair[]> operation) { var result = operation.Expected; // Dense Succeed( operators: operation.DataWritableOps, data: operation.Data.AsDense, dataOperation: operation.DataOperation, expected: result); // Sparse Succeed( operators: operation.DataWritableOps, data: operation.Data.AsSparse, dataOperation: operation.DataOperation, expected: result); // Dense.AsReadOnly() Succeed( operators: operation.DataReadOnlyOps, data: operation.Data.AsDense.AsReadOnly(), dataOperation: operation.DataOperation, expected: result); // Sparse.AsReadOnly() Succeed( operators: operation.DataReadOnlyOps, data: operation.Data.AsSparse.AsReadOnly(), dataOperation: operation.DataOperation, expected: result); }
/// <summary> /// Determines whether the specified operation fails as expected. /// </summary> /// <param name="operation">The operation to test.</param> public static void Fail <TException>( AlongDimensionExtremumOperation <TException> operation) where TException : Exception { var exception = operation.Expected; // Dense Fail( operators: operation.DataWritableOps, data: operation.Data.AsDense, dataOperation: operation.DataOperation, exception: exception); // Sparse Fail( operators: operation.DataWritableOps, data: operation.Data.AsSparse, dataOperation: operation.DataOperation, exception: exception); // Dense.AsReadOnly() Fail( operators: operation.DataReadOnlyOps, data: operation.Data.AsDense.AsReadOnly(), dataOperation: operation.DataOperation, exception: exception); // Sparse.AsReadOnly() Fail( operators: operation.DataReadOnlyOps, data: operation.Data.AsSparse.AsReadOnly(), dataOperation: operation.DataOperation, exception: exception); }
/// <summary> /// Tests an operation /// whose data operand is set through a value represented by a <b>null</b> instance. /// </summary> /// <param name="operation">The operation to test.</param> public static void DataIsNull( AlongDimensionExtremumOperation <ArgumentNullException> operation) { var exception = operation.Expected; Fail( operators: operation.DataWritableOps, data: null, dataOperation: DataOperation.OnRows, exception: exception); Fail( operators: operation.DataReadOnlyOps, data: null, dataOperation: DataOperation.OnRows, exception: exception); }