/// <summary>
 /// Method for get all test
 /// </summary>
 /// <returns>test list</returns>
 public List <GetAllTest> GetAllTest()
 {
     try
     {
         List <GetAllTest> lstGetAllTest = new List <GetAllTest>();
         using (SqlConnection connection = new SqlConnection(this.conn))
         {
             string sql = "GetAllTest";
             using (SqlCommand command = new SqlCommand(sql, connection))
             {
                 command.CommandType = CommandType.StoredProcedure;
                 connection.Open();
                 SqlDataReader reader = command.ExecuteReader();
                 while (reader.Read())
                 {
                     GetAllTest getAllTest = new GetAllTest();
                     getAllTest.Date         = Convert.ToDateTime(reader["Date"].ToString());
                     getAllTest.TestId       = long.Parse(reader["TestId"].ToString());
                     getAllTest.Name         = reader["Name"].ToString();
                     getAllTest.AthleteCount = int.Parse(reader["AthleteCount"].ToString());
                     lstGetAllTest.Add(getAllTest);
                 }
                 connection.Close();
             }
         }
         return(lstGetAllTest);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Exemple #2
0
        public void GetAll_should_store_results_in_dictionary()
        {
            var dictionary = new Dictionary <string, JArray>();

            var subject = new GetAllTest(_resource, dictionary, _configuration, tokenHandler);
            var result  = subject.PerformTest().Result;

            Assert.IsNotNull(dictionary[ResourceName]);
            Assert.IsTrue(result);
        }
Exemple #3
0
        public async Task GetAll_should_store_results_in_dictionaryAsync()
        {
            var dictionary = new Dictionary <string, JArray>();

            var configuration = Mock.Of <IApiConfiguration>(cfg => cfg.Url == Address);

            var subject = new GetAllTest(_resource, dictionary, configuration, tokenHandler);
            var result  = await subject.PerformTest();

            Assert.IsNotNull(dictionary[ResourceName]);
            Assert.IsTrue(result);
        }