예제 #1
0
        public void GetNumberLookupResultsTest()
        {
            //Arrange
            Twizo twizo = new Twizo(apiKey, apiHost);

            //Act
            var results = twizo.GetNumberLookupResults();

            //Assert
            Assert.IsNotNull(results);
        }
예제 #2
0
        private void Results()
        {
            string file = Menu.MyResultsFolder + @"\TwizoTestLogResults.txt";

            File.Delete(file);

            Twizo twizo         = new Twizo(apiKey, apiHost);
            var   SmsReports    = twizo.GetSmsResults();
            var   LookupResults = twizo.GetNumberLookupResults();

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("---------------SMS REPORTS---------------");
            foreach (var sms in SmsReports)
            {
                Type           type       = sms.GetType();
                PropertyInfo[] properties = type.GetProperties();
                foreach (PropertyInfo property in properties)
                {
                    sb.AppendLine(String.Format("{0, -25} : {1}", property.Name, property.GetValue(sms, null)));
                }
                sb.AppendLine(Environment.NewLine);
                sb.AppendLine("----------------------");
            }

            sb.AppendLine("----------NUMBER LOOKUP RESULTS----------");
            foreach (var lookup in LookupResults)
            {
                Type           type       = lookup.GetType();
                PropertyInfo[] properties = type.GetProperties();
                foreach (PropertyInfo property in properties)
                {
                    sb.AppendLine(String.Format("{0, -25} : {1}", property.Name, property.GetValue(lookup, null)));
                }
                sb.AppendLine(Environment.NewLine);
                sb.AppendLine("----------------------");
            }

            File.AppendAllText(file, sb.ToString());

            Process.Start(file);
            Console.WriteLine("Results were succesfully requested and written to TwizoTestLogResults.txt");
            Console.WriteLine("Press any key to return to main menu.");
            Console.ReadKey(true);
            RunMenu();
        }