public async Task DoNotThrowOnNullFrom() { // Arrange var mockTelemetryClient = new Mock <IBotTelemetryClient>(); TestAdapter adapter = new TestAdapter(new ConversationReference() { ChannelId = Channels.Test, Bot = new ChannelAccount("bot", "Bot"), Conversation = new ConversationAccount() { Id = Guid.NewGuid().ToString("n") } }) .Use(new TelemetryLoggerMiddleware(mockTelemetryClient.Object, logPersonalInformation: false)); // Act // Ensure LogPersonalInformation flag works await new TestFlow(adapter, async(context, cancellationToken) => { await adapter.CreateConversationAsync( context.Activity.ChannelId, async(context, cancellationToken) => { await context.SendActivityAsync("proactive"); }, new CancellationToken()); }) .Send("foo") .AssertReply("proactive") .StartTestAsync(); // Assert Assert.Equal(1, mockTelemetryClient.Invocations.Count); Assert.Equal("BotMessageReceived", mockTelemetryClient.Invocations[0].Arguments[0]); // Check initial message Assert.True(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).Count == 6); Assert.True(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("type")); Assert.Equal(ActivityTypes.Message, ((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1])["type"]); Assert.True(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("fromId")); Assert.True(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1])["fromId"] == null); Assert.True(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("conversationName")); Assert.True(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("locale")); Assert.True(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("recipientId")); Assert.True(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("recipientName")); Assert.False(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("fromName")); Assert.False(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("text")); }