示例#1
0
        public void ReturnNullWhenProfileDataIsNull()
        {
            var lobbyManager = new LobbyManagerStub();
            var lobbyUrl     = GameWorker.GetProLobbyUrl(lobbyManager, "123456");

            Assert.IsNull(lobbyUrl, "Lobby url must be null when profile data is null.");
        }
示例#2
0
        public void ReturnNullWhenGameIdIsNull()
        {
            var lobbyManager = new LobbyManagerStub(null, "1234");
            var lobbyUrl     = GameWorker.GetProLobbyUrl(lobbyManager, "123456");

            Assert.IsNull(lobbyUrl, "Lobby url must be null when gameId is null.");
        }
示例#3
0
        public void ReturnNullWhenLobbySteamIdIsNull()
        {
            var lobbyManager = new LobbyManagerStub("9876", null);
            var lobbyUrl     = GameWorker.GetProLobbyUrl(lobbyManager, "123456");

            Assert.IsNull(lobbyUrl, "Lobby url must be null when lobbySteamId is null.");
        }
示例#4
0
        public void ReturnCorrectLobbyUrlWhenPlayerHasCorrectProfileData()
        {
            const string gameId       = "9876";
            const string lobbyId      = "1234";
            const string playerId     = "13579";
            var          lobbyManager = new LobbyManagerStub(gameId, lobbyId);
            var          lobbyUrl     = GameWorker.GetProLobbyUrl(lobbyManager, playerId);

            Assert.IsNotNull(lobbyUrl, "LobbyUrl must be not null.");
            StringAssert.IsMatch($"steam://joinlobby/{gameId}/{lobbyId}/{playerId}", lobbyUrl, "Lobby has incorrect format.");
        }
        public string ProLobbyUrl(string proId)
        {
            if (string.IsNullOrEmpty(proId))
            {
                return(null);
            }

            var webClient    = new WebClient();
            var lobbyManager = new LobbyManager(webClient);

            var result = GameWorker.GetProLobbyUrl(lobbyManager, proId);

            return(result);
        }