Example #1
0
        public async Task <UserDto> Join(string connectionId, string username, string roomName)
        {
            var room = await roomRepository.FindBydNameAsync(roomName);

            if (room == null)
            {
                throw new NotFoundException(nameof(room));
            }

            var user = await userRepository.FindByNameAsync(username);

            if (user != null)
            {
                throw new DuplicateUserException(username);
            }

            user = UserBuild(connectionId, username, room);

            await userRepository.CreateAsync(user);

            return(userEntityToDtoMapper.ToMap(user));
        }
        public void DeveRetornarNuloQuandoForNulo()
        {
            var actual = mapper.ToMap(null);

            Assert.Null(actual);
        }