public async Task WhenCreateInputExpirationMessageWithTraceMetadataThenTraceMetadataMustbePresent() { // Arrange var traceIdentity = new Identity(Guid.NewGuid().ToString(), "msging.net"); var mode = "All"; var targetType = "Lime"; Message.Metadata = new Dictionary <string, string> { { TraceSettings.BUILDER_TRACE_MODE, mode }, { TraceSettings.BUILDER_TRACE_TARGET_TYPE, targetType }, { TraceSettings.BUILDER_TRACE_TARGET, traceIdentity }, }; var messageType = InputExpiration.MIME_TYPE; Message.Content = new PlainText() { Text = "Teste" }; var state = new State { Id = "ping", Input = new Builder.Models.Input() { Expiration = TimeSpan.FromMinutes(1) } }; // Act await InputHandler.OnFlowProcessedAsync(state, Message, null, default(CancellationToken)); // Assert Scheduler .Received(1) .ScheduleMessageAsync( Arg.Is <Message>(m => m.Id != null && m.To.ToIdentity().Equals(ApplicationIdentity) && m.Type.ToString().Equals(messageType) && m.Content is InputExpiration && UserIdentity.Equals((m.Content as InputExpiration).Identity) && state.Id.Equals((m.Content as InputExpiration).StateId) && m.Metadata.ContainsKey(TraceSettings.BUILDER_TRACE_TARGET) && m.Metadata.ContainsKey(TraceSettings.BUILDER_TRACE_TARGET_TYPE) && m.Metadata.ContainsKey(TraceSettings.BUILDER_TRACE_MODE) ), Arg.Any <DateTimeOffset>(), Arg.Any <Node>(), Arg.Is <CancellationToken>(c => !c.IsCancellationRequested)); }