public void GivenAConnectedUserWithManyConnections_WhenTheUserDisconnectFromAllConnections_ThenTheUserShouldLeaveChat() { var chat = new ChatRoom(); chat.Connect("username", DummyDateTime, "connection1"); chat.Connect("username", DummyDateTime, "connection2"); chat.Disconnect("connection1", DummyDateTime); ChatEvent chatEvent = chat.Disconnect("connection2", Now); chatEvent.Should().Be(ChatEvent.UserLeavesChat("username", Now)); }
private async Task Disconnect() { if (ChatRoom == null) { DisplayError("You are not connected to a server."); } await ChatRoom.Disconnect(); }
public void GivenAConnectedUserWithManyConnections_WhenTheUserDisconnectFromOneConnection_ThenNothingHappens() { var chat = new ChatRoom(); chat.Connect("username", DummyDateTime, "connection1"); chat.Connect("username", DummyDateTime, "connection2"); ChatEvent chatEvent = chat.Disconnect("connection1", Now); chatEvent.Should().Be(ChatEvent.NothingHappens(Now)); }
public void GivenAConnectedUser_WhenTheUserDisconnect_ThenTheUserShouldLeaveChat() { var chat = new ChatRoom(); chat.Connect("username", DummyDateTime, "connection"); ChatEvent chatEvent = chat.Disconnect("connection", Now); chatEvent.Should().Be( ChatEvent.UserLeavesChat("username", Now)); }
public void GivenSomeConnectedUsers_WhenANotConnectedUserDisconnect_ThenNothingHappens() { var chat = new ChatRoom(); chat.Connect("dummyUser1", DummyDateTime, DummyConnectionId()); chat.Connect("dummyUser2", DummyDateTime, DummyConnectionId()); ChatEvent chatEvent = chat.Disconnect("newConnection", Now); chatEvent.Should().Be( ChatEvent.NothingHappens(Now)); }
public void GivenAnEmptyChatRoom_WhenANewUserDisconnect_ThenNothingHappens() { var chat = new ChatRoom(); ChatEvent chatEvent = chat.Disconnect("dummyConnection", Now); chatEvent.Should().Be( ChatEvent.NothingHappens(Now)); }