public async Task Get_Good_Address()
        {
            // Good address name.
            var buffer = await HttpDataUtility.GetDataFromHttpServer("https://api.mobileqa.mlbinfra.com/api/interview/v1/records");

            Assert.AreNotEqual(buffer.Length, 0);
        }
Пример #2
0
        /// <summary>
        /// Initializes the Data retrieved from the specified address and stores it in a list.
        /// </summary>
        /// <returns>
        /// True: If the initialization completed successfully.
        /// False: If the initialization failed.
        /// </returns>
        public async Task <bool> Initialize()
        {
            try
            {
                string data = await HttpDataUtility.GetDataFromHttpServer(_address);

                if (data != null && data.Length > 0)
                {
                    _teamsResults = JsonDeserializationUtility.DeserializeJsonToSeasonResults(data);
                    if (_teamsResults != null && _teamsResults.Count > 0)
                    {
                        return(true);
                    }
                }
            }
            catch
            {
                // Since there is no real way to handle not getting the data return false.
                return(false);
            }

            // If there is no exception but the team results comes back null or empty return false.
            return(false);
        }
 public async Task Utility_Throws_InvalidOperationException()
 {
     var buffer = await HttpDataUtility.GetDataFromHttpServer("htpps://fake");
 }
 public async Task Get_Null_Address()
 {
     // Null address this should fail.
     var buffer = await HttpDataUtility.GetDataFromHttpServer(null);
 }