/// <summary> /// Determines whether the specified operation terminates successfully as expected. /// </summary> /// <param name="operation">The operation.</param> public static void Succeed( SortIndexOperation <SortIndexResults> operation) { var result = operation.Expected; // Dense Succeed( operators: operation.DataWritableOps, data: operation.Data.AsDense, sortDirection: operation.SortDirection, expected: result); // Sparse Succeed( operators: operation.DataWritableOps, data: operation.Data.AsSparse, sortDirection: operation.SortDirection, expected: result); // Dense.AsReadOnly() Succeed( operators: operation.DataReadOnlyOps, data: operation.Data.AsDense.AsReadOnly(), sortDirection: operation.SortDirection, expected: result); // Sparse.AsReadOnly() Succeed( operators: operation.DataReadOnlyOps, data: operation.Data.AsSparse.AsReadOnly(), sortDirection: operation.SortDirection, 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>( SortIndexOperation <TException> operation) where TException : Exception { var exception = operation.Expected; // Dense Fail( operators: operation.DataWritableOps, data: operation.Data.AsDense, sortDirection: operation.SortDirection, exception: exception); // Sparse Fail( operators: operation.DataWritableOps, data: operation.Data.AsSparse, sortDirection: operation.SortDirection, exception: exception); // Dense.AsReadOnly() Fail( operators: operation.DataReadOnlyOps, data: operation.Data.AsDense.AsReadOnly(), sortDirection: operation.SortDirection, exception: exception); // Sparse.AsReadOnly() Fail( operators: operation.DataReadOnlyOps, data: operation.Data.AsSparse.AsReadOnly(), sortDirection: operation.SortDirection, 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( SortIndexOperation <ArgumentNullException> operation) { var exception = operation.Expected; Fail( operators: operation.DataWritableOps, data: null, sortDirection: SortDirection.Ascending, exception: exception); Fail( operators: operation.DataReadOnlyOps, data: null, sortDirection: SortDirection.Descending, exception: exception); }