forked from statianzo/Fleck
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Moq dll. Moved test libs. Server creates ListenerSocket in cons…
…tructor
- Loading branch information
Showing
7 changed files
with
5,171 additions
and
9 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Net; | ||
using Moq; | ||
using NUnit.Framework; | ||
|
||
namespace Fleck.Tests | ||
{ | ||
[TestFixture] | ||
public class WebSocketServerTests | ||
{ | ||
private WebSocketServer _server; | ||
private MockRepository _repository; | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
_repository = new MockRepository(MockBehavior.Default); | ||
_server = new WebSocketServer("ws://localhost:8000"); | ||
} | ||
|
||
[Test] | ||
public void ShouldStart() | ||
{ | ||
var socketMock = _repository.Create<ISocket>(); | ||
|
||
_server.ListenerSocket = socketMock.Object; | ||
_server.Start(connection => { }); | ||
|
||
socketMock.Verify(s => s.Bind(It.Is<IPEndPoint>(i => i.Port == 8000))); | ||
socketMock.Verify(s => s.BeginAccept(It.IsAny<AsyncCallback>(), It.IsAny<object>())); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,5 +40,4 @@ public void Close() | |
Socket.Close(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters