Exemplo n.º 1
0
        public void CountByState_ReturnOne_ForGivenState()
        {
            //Arrange
            string state = "Ods";
            //Act
            Dictionary <string, int> countByState = SqlServerOperation.CountByState();

            //Assert
            Assert.AreEqual(1, countByState[state]);
        }
Exemplo n.º 2
0
        public static void LinqOperations()
        {
            //1
            List <DataRow> data = SqlServerOperation.ContactsAddedBetweenDateRange(new DateTime(2020, 11, 01), DateTime.Today);

            Console.WriteLine("Contacts added between 01/11/2020 and Today ");
            foreach (DataRow row in data)
            {
                Console.WriteLine(row.Field <string>("ContactName"));
            }
            Console.WriteLine();
            //2
            Dictionary <string, int> countByCity = SqlServerOperation.CountByCity();

            Console.WriteLine("City\tCount");
            foreach (var item in countByCity)
            {
                Console.WriteLine(item.Key + "\t" + item.Value);
            }
            Console.WriteLine();
            //3
            Dictionary <string, int> countByState = SqlServerOperation.CountByState();

            Console.WriteLine("State\tCount");
            foreach (var item in countByState)
            {
                Console.WriteLine(item.Key + "\t" + item.Value);
            }
            Console.WriteLine();
            //4
            //ContactDetails contact = new ContactDetails("Shyam", "Kumar", "Barauni", "Patna", "710923", "9309165207", "*****@*****.**");
            //SqlServerOperation.AddContactDetail("College", "ShyamBmep", contact);

            //5
            SqlServerOperation.WriteFromSqlServerToJson();
        }