Fixing tests.
This commit is contained in:
Родитель
b23d5d167d
Коммит
81b3d2f9d8
|
@ -4,6 +4,7 @@ using System.IO.Pipes;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Bot.Builder.Integration.AspNet.Core;
|
||||
using Microsoft.Bot.Streaming.Tests.Utilities;
|
||||
using Microsoft.Bot.Streaming.Transport.NamedPipes;
|
||||
using Xunit;
|
||||
|
||||
|
@ -17,9 +18,9 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
var pipeName = Guid.NewGuid().ToString();
|
||||
var readStream = new NamedPipeServerStream(pipeName, PipeDirection.In, NamedPipeServerStream.MaxAllowedServerInstances, PipeTransmissionMode.Byte, PipeOptions.WriteThrough | PipeOptions.Asynchronous);
|
||||
var writeStream = new NamedPipeClientStream(".", pipeName, PipeDirection.Out, PipeOptions.WriteThrough | PipeOptions.Asynchronous);
|
||||
new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), pipeName);
|
||||
new StreamingRequestHandler(new Microsoft.Bot.Streaming.UnitTests.Mocks.MockBot(), new BotFrameworkHttpAdapter(), pipeName);
|
||||
var reader = new NamedPipeClient(pipeName);
|
||||
var writer = new NamedPipeServer(pipeName, new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), pipeName));
|
||||
var writer = new NamedPipeServer(pipeName, new StreamingRequestHandler(new Microsoft.Bot.Streaming.UnitTests.Mocks.MockBot(), new BotFrameworkHttpAdapter(), pipeName));
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
public void CanBeConstructedWithANamedPipe()
|
||||
{
|
||||
// Act
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), "fakePipe");
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), "fakePipe");
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(handler);
|
||||
|
@ -72,7 +72,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
public void CanBeConstructedWithAWebSocket()
|
||||
{
|
||||
// Act
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), new FauxSock());
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), new FauxSock());
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(handler);
|
||||
|
@ -82,7 +82,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
public async Task RequestHandlerRespondsWith500OnError()
|
||||
{
|
||||
// Arrange
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), "fakePipe");
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), "fakePipe");
|
||||
var conversationId = "testconvoid";
|
||||
var membersAdded = new List<ChannelAccount>();
|
||||
var member = new ChannelAccount
|
||||
|
@ -119,7 +119,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
public async Task RequestHandlerRemembersConversations()
|
||||
{
|
||||
// Arrange
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), "fakePipe");
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), "fakePipe");
|
||||
var conversationId = "testconvoid";
|
||||
var membersAdded = new List<ChannelAccount>();
|
||||
var member = new ChannelAccount
|
||||
|
@ -156,7 +156,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
public async Task RequestHandlerForgetsConversations()
|
||||
{
|
||||
// Arrange
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), "fakePipe");
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), "fakePipe");
|
||||
var conversationId = "testconvoid";
|
||||
var membersAdded = new List<ChannelAccount>();
|
||||
var member = new ChannelAccount
|
||||
|
@ -194,7 +194,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
public async Task RequestHandlerAssignsAServiceUrl()
|
||||
{
|
||||
// Arrange
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), "fakePipe");
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), "fakePipe");
|
||||
var conversationId = "testconvoid";
|
||||
var serviceUrl = "urn:FakeName:fakeProtocol://fakePath";
|
||||
var membersAdded = new List<ChannelAccount>();
|
||||
|
@ -235,7 +235,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
// Arrange
|
||||
|
||||
// Act
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), "fakePipe");
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), "fakePipe");
|
||||
var activity = new Schema.Activity()
|
||||
{
|
||||
Type = "message",
|
||||
|
|
|
@ -13,6 +13,7 @@ using Microsoft.Bot.Builder.Integration.AspNet.Core;
|
|||
using Microsoft.Bot.Schema;
|
||||
using Microsoft.Bot.Streaming;
|
||||
using Microsoft.Bot.Streaming.Payloads;
|
||||
using Microsoft.Bot.Streaming.UnitTests.Mocks;
|
||||
using Newtonsoft.Json;
|
||||
using Xunit;
|
||||
|
||||
|
@ -24,7 +25,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
public void CanBeConstructedWithANamedPipe()
|
||||
{
|
||||
// Act
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), Guid.NewGuid().ToString());
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), Guid.NewGuid().ToString());
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(handler);
|
||||
|
@ -39,7 +40,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
// Act
|
||||
try
|
||||
{
|
||||
var handler = new StreamingRequestHandler(null, activityProcessor: new BotFrameworkHttpAdapter(), socket: null);
|
||||
var handler = new StreamingRequestHandler(new MockBot(), activityProcessor: new BotFrameworkHttpAdapter(), socket: null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -59,7 +60,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
// Act
|
||||
try
|
||||
{
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), string.Empty);
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), string.Empty);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -74,7 +75,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
public void CanBeConstructedWithAWebSocket()
|
||||
{
|
||||
// Act
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), new FauxSock());
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), new FauxSock());
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(handler);
|
||||
|
@ -84,7 +85,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
public async void RequestHandlerRespondsWith500OnError()
|
||||
{
|
||||
// Arrange
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), Guid.NewGuid().ToString());
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), Guid.NewGuid().ToString());
|
||||
var conversationId = Guid.NewGuid().ToString();
|
||||
var membersAdded = new List<ChannelAccount>();
|
||||
var member = new ChannelAccount
|
||||
|
@ -122,7 +123,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
{
|
||||
// Arrange
|
||||
var adapter = new BotFrameworkHttpAdapter();
|
||||
var handler = new StreamingRequestHandler(null, adapter, Guid.NewGuid().ToString());
|
||||
var handler = new StreamingRequestHandler(new MockBot(), adapter, Guid.NewGuid().ToString());
|
||||
var conversationId = Guid.NewGuid().ToString();
|
||||
var membersAdded = new List<ChannelAccount>();
|
||||
var member = new ChannelAccount
|
||||
|
@ -159,7 +160,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
public async void RequestHandlerForgetsConversations()
|
||||
{
|
||||
// Arrange
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), Guid.NewGuid().ToString());
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), Guid.NewGuid().ToString());
|
||||
var conversationId = Guid.NewGuid().ToString();
|
||||
var membersAdded = new List<ChannelAccount>();
|
||||
var member = new ChannelAccount
|
||||
|
@ -197,7 +198,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
public async void RequestHandlerAssignsAServiceUrl()
|
||||
{
|
||||
// Arrange
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), Guid.NewGuid().ToString());
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), Guid.NewGuid().ToString());
|
||||
var conversationId = Guid.NewGuid().ToString();
|
||||
var serviceUrl = "urn:FakeName:fakeProtocol://fakePath";
|
||||
var membersAdded = new List<ChannelAccount>();
|
||||
|
@ -238,7 +239,7 @@ namespace Microsoft.Bot.Builder.Streaming.Tests
|
|||
// Arrange
|
||||
|
||||
// Act
|
||||
var handler = new StreamingRequestHandler(null, new BotFrameworkHttpAdapter(), Guid.NewGuid().ToString());
|
||||
var handler = new StreamingRequestHandler(new MockBot(), new BotFrameworkHttpAdapter(), Guid.NewGuid().ToString());
|
||||
var activity = new Schema.Activity()
|
||||
{
|
||||
Type = "message",
|
||||
|
|
Загрузка…
Ссылка в новой задаче