Пример #1
0
 public static ServiceWrapper AddUsers(List <UserDTO> lstUserDTO)
 {
     try
     {
         var userServiceClient = new UserServiceClient();
         var usersInserted     = userServiceClient.AddUsers(lstUserDTO.ToArray());
         return(WarpServiceCall(usersInserted, false, string.Empty));
     }
     catch (Exception ex)
     {
         return(WarpServiceCall(string.Empty, true, ex.Message));
     }
 }
        public void Test_AddUser_With_Exception()
        {
            var userServiceClient = new UserServiceClient();

            Assert.ThrowsException <FaultException>(() => userServiceClient.AddUsers(new List <UserDTO>
            {
                new UserDTO
                {
                    FirstName = "TEST_EXCEPTION",
                    LastName  = "TEST_EXCEPTION",
                    Cellphone = string.Empty,
                }
            }.ToArray()));
        }
        public void Test_AddUser_SuccessResponse()
        {
            var userServiceClient         = new UserServiceClient();
            var userServiceClientResponse = userServiceClient.AddUsers(new List <UserDTO>
            {
                new UserDTO
                {
                    FirstName = "TEST54",
                    LastName  = "TEST54",
                    Cellphone = "1234567890"
                },
                new UserDTO
                {
                    FirstName = "TEST23",
                    LastName  = "TEST23",
                    Cellphone = "0545478545",
                }
            }.ToArray());

            Assert.AreEqual(userServiceClientResponse, true);
        }