コード例 #1
0
        public async Task Given_RoomNameAndUserName_When_InvalidRoomName_And_UserInRoom_Then_LeaveRoomShouldNotLeaveRoom()
        {
            Assert.False(DbInMemorySqlite.Rooms.Any());
            DatabaseSetup.AddUser(DbInMemorySqlite);
            _messageHub = new MessageHub(DbInMemorySqlite);
            AssignToHubRequiredProperties(_messageHub);
            await _messageHub.CreateRoom(new RoomModel { RoomName = "RoomieGroomie", UserName = "******", Category = ItemCategory.categories[0] }, new ItemModel { Name = "Flowers", Category = ItemCategory.categories[0], Description = "A flower", URL = "flowerurlhahahehe.com" });

            await _messageHub.JoinRoom("RoomieGroomie", "Vasea");

            var userFromDb = DbInMemorySqlite.Users.FirstOrDefault();

            Assert.Equal("RoomieGroomie", userFromDb.Room);
            DbInMemorySqlite.ChangeTracker.Clear();
            await _messageHub.LeaveRoom("CameraCareNuExista", "Vasea");

            userFromDb = DbInMemorySqlite.Users.FirstOrDefault();

            Assert.Equal("RoomieGroomie", userFromDb.Room);
        }