Exemplo n.º 1
0
        public void SingleObjectHurlTest()
        {
            SqlDataRequest dataRequest = new SqlDataRequest(ConnectionString);

            var obj = new
            {
                Id           = Guid.NewGuid(),
                Name         = string.Format("Test :{0}", DateTime.Now.ToLongDateString()),
                Description  = string.Format("Description :{0}", DateTime.Now.ToLongDateString()),
                Details      = string.Format("Details :{0}", DateTime.Now.ToLongDateString()),
                RecordedDate = DateTime.Now,
                IsActive     = true
            };

            int rowsAffected = dataRequest.Hurl("[dbo].[usp_Test_Insert]", obj);

            Assert.IsTrue(rowsAffected > 0);
        }
Exemplo n.º 2
0
        public void MultiObjectHurlTest()
        {
            SqlDataRequest dataRequest = new SqlDataRequest(ConnectionString);

            var objForList1 = new
            {
                Id           = Guid.NewGuid(),
                Name         = string.Format("Test :{0}", DateTime.Now.ToLongDateString()),
                Description  = string.Format("Description :{0}", DateTime.Now.ToLongDateString()),
                Details      = string.Format("Details :{0}", DateTime.Now.ToLongDateString()),
                RecordedDate = DateTime.Now,
                IsActive     = true
            };

            var objForList2 = new
            {
                Id           = Guid.NewGuid(),
                Name         = string.Format("Test :{0}", DateTime.Now.ToLongDateString()),
                Description  = string.Format("Description :{0}", DateTime.Now.ToLongDateString()),
                Details      = string.Format("Details :{0}", DateTime.Now.ToLongDateString()),
                RecordedDate = DateTime.Now,
                IsActive     = true
            };

            var objForList3 = new
            {
                Id           = Guid.NewGuid(),
                Name         = string.Format("Test :{0}", DateTime.Now.ToLongDateString()),
                Description  = string.Format("Description :{0}", DateTime.Now.ToLongDateString()),
                Details      = string.Format("Details :{0}", DateTime.Now.ToLongDateString()),
                RecordedDate = DateTime.Now,
                IsActive     = true
            };
            List <dynamic> objects = new List <dynamic>()
            {
                objForList1, objForList2, objForList3
            };

            int rowsAffected3 = dataRequest.Hurl("[dbo].[usp_Test_Insert]", objects);

            Assert.IsTrue(rowsAffected3 > 0);
        }