static ExecuteOpRequestedEventTOperationTest() { ConstructorArgumentValidationTestScenarios .RemoveAllScenarios() .AddScenario( () => new ConstructorArgumentValidationTestScenario <ExecuteOpRequestedEvent <GetProtocolByTypeOp> > { Name = "constructor should throw ArgumentNullException when parameter 'operation' is null scenario", ConstructionFunc = () => { var referenceObject = A.Dummy <ExecuteOpRequestedEvent <GetProtocolByTypeOp> >(); var result = new ExecuteOpRequestedEvent <GetProtocolByTypeOp>( null, referenceObject.TimestampUtc, referenceObject.Details); return(result); }, ExpectedExceptionType = typeof(ArgumentNullException), ExpectedExceptionMessageContains = new[] { "operation", }, }); }
/// <inheritdoc /> public override async Task <NotificationTrackingCode> ExecuteAsync( SendNotificationOp operation) { new { operation }.AsArg().Must().NotBeNull(); var notificationTrackingCodeId = await this.clientOperationStream.GetNextUniqueLongAsync(); var result = new NotificationTrackingCode(notificationTrackingCodeId); var executeOperationRequestedEvent = new ExecuteOpRequestedEvent <long, SendNotificationOp>(notificationTrackingCodeId, operation, DateTime.UtcNow); var tags = this.buildExecuteSendNotificationEventTagsProtocol.ExecuteBuildTags(result.Id, executeOperationRequestedEvent); await this.clientOperationStream.PutWithIdAsync(notificationTrackingCodeId, executeOperationRequestedEvent, tags, ExistingRecordStrategy.DoNotWriteIfFoundById); return(result); }
private async Task PutSagaAsync( long trackingCodeId, IReadOnlyDictionary <IDeliveryChannel, IReadOnlyList <ChannelOperationInstruction> > channelToOperationInstructionsMap, IReadOnlyCollection <NamedValue <string> > inheritableTags) { var channelToOperationsMonitoringInfoMap = channelToOperationInstructionsMap.ToDictionary( _ => _.Key, _ => (IReadOnlyList <ChannelOperationMonitoringInfo>)_.Value.Select(c => c.MonitoringInfo).ToList()); var processSendNotificationSagaOp = new ProcessSendNotificationSagaOp(trackingCodeId, channelToOperationsMonitoringInfoMap); var @event = new ExecuteOpRequestedEvent <long, ProcessSendNotificationSagaOp>(trackingCodeId, processSendNotificationSagaOp, DateTime.UtcNow); var tags = this.buildExecuteProcessSendNotificationSagaEventTagsProtocol.ExecuteBuildTags(trackingCodeId, @event, inheritableTags); await this.sagaStream.PutWithIdAsync(trackingCodeId, @event, tags, ExistingRecordStrategy.DoNotWriteIfFoundById); }