Example #1
0
        public async Task ConnectionWithAlreadyConnectedAccountAsync()
        {
            var packet = new DacPacket
            {
                Slot        = 2,
                AccountName = _accountName
            };

            _channelHttpClient.Setup(o => o.GetChannelsAsync()).ReturnsAsync(new List <ChannelInfo>()
            {
                new ChannelInfo
                {
                    Id = 1,
                }
            });
            _connectedAccountHttpClient.Setup(o => o.GetConnectedAccountAsync(It.IsAny <ChannelInfo>())).ReturnsAsync(
                new List <ConnectedAccount>
            {
                new ConnectedAccount
                {
                    ChannelId = 1,
                    Name      = _accountName
                }
            });
            await _dacPacketHandler.ExecuteAsync(packet, _session);

            Logger.Verify(o => o.Error(It.Is <string>(o => o == LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.ALREADY_CONNECTED)), It.Is <It.IsAnyType>((v, t) => true)), Times.Once);
            Assert.IsNull(_session !.Account);
        }
Example #2
0
        public async Task ConnectionWithInvalidAccountAsync()
        {
            var packet = new DacPacket
            {
                Slot        = 2,
                AccountName = "fakeName"
            };
            await _dacPacketHandler.ExecuteAsync(packet, _session);

            Logger.Verify(o => o.Error(It.Is <string>(o => o == LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.INVALID_ACCOUNT)), It.Is <It.IsAnyType>((v, t) => true)), Times.Once);

            Assert.IsNull(_session !.Account);
        }
Example #3
0
        public async Task ConnectionWithInwaitingAccountAsync()
        {
            var packet = new DacPacket
            {
                Slot        = 0,
                AccountName = _accountName
            };

            _authHttpClient.Setup(authHttpClient => authHttpClient
                                  .GetAwaitingConnectionAsync(It.IsAny <string?>(), It.IsAny <string>(), It.IsAny <int>()))
            .ReturnsAsync("123");
            await _dacPacketHandler.ExecuteAsync(packet, _session);

            Assert.IsNotNull(_session !.Account);
        }