Last active
December 30, 2015 05:59
-
-
Save makomweb/7785873 to your computer and use it in GitHub Desktop.
Send a message to the WS server and receive a reply.
This file contains hidden or 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
[Fact] | |
public async Task Getting_an_event_when_connecting_should_succeed() | |
{ | |
using (var ws = new ReactiveWebSocket("ws://127.0.0.1:8080", true)) | |
{ | |
var man = new WebSocketManager(ws); | |
man.Send(new Message { Id = Guid.NewGuid().ToString() }); | |
var res = await man.Results.FirstAsync(); | |
Assert.Equal(typeof(IncomingEvent), res.GetType()); | |
var ev = ((IncomingEvent) res).Event; | |
ev.Should().NotBeNull(); | |
ev.Id.Should().Be(2); | |
ev.PreviousId.Should().Be(1); | |
ev.Client.Should().NotBeNull(); | |
ev.Subject.Should().NotBeNull(); | |
ev.Operation.Should().Be("update"); | |
ev.Revision.Should().Be(2); | |
ev.Data["title"].Should().Be("Wow"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment