private async Task <GetDeliveryChannelConfigsResult> GetDeliveryChannelConfigsAsync( INotification notification, IAudience audience) { GetDeliveryChannelConfigsResult result; try { var getDeliveryChannelConfigsOp = new GetDeliveryChannelConfigsOp(notification, audience); result = await this.getDeliveryChannelConfigsProtocol.ExecuteAsync(getDeliveryChannelConfigsOp); result.AsOp().Must().NotBeNull(Invariant($"Executing {nameof(GetDeliveryChannelConfigsOp)} should not return null.")); } catch (Exception ex) { result = new GetDeliveryChannelConfigsResult(null, new[] { new ExceptionThrownFailure(ex.ToString()) }, FailureAction.Stop); } return(result); }
public async Task <GetDeliveryChannelConfigsResult> ExecuteAsync( GetDeliveryChannelConfigsOp operation) { new { operation }.AsArg().Must().NotBeNull(); new { operation.Notification }.AsArg().Must().NotBeNull().And().BeOfType <IntegrationTestNotification>(); new { operation.Audience }.AsArg().Must().NotBeNull().And().BeOfType <IntegrationTestAudience>(); var getDeliveryChannelConfigsResult = new GetDeliveryChannelConfigsResult( new[] { new DeliveryChannelConfig(new EmailDeliveryChannel(), DeliveryChannelAction.SendOnChannel), new DeliveryChannelConfig(new SlackDeliveryChannel(), DeliveryChannelAction.SendOnChannel), }, new[] { new ExceptionThrownFailure("exception-thrown-get-delivery-channel-configs"), }, FailureAction.IgnoreAndProceedIfPossibleOtherwiseStop); var result = await Task.FromResult(getDeliveryChannelConfigsResult); return(result); }