ExtensionesTest.cs
1 using System;
2 using System.Windows.Forms;
3 using Microsoft.VisualStudio.TestTools.UnitTesting;
4 using sage.ew.db;
5 using sage.ew.global;
6 using System.Data;
7 using System.IO;
8 using sage.ew.ewbase;
9 using System.Reflection;
11 using sage.ew.functions.Clases;
12 using Sage.ES.S50.Addons;
13 using sage.ew.functions;
15 using Sage.ES.S50.UnitTest.Mock.Mock;
16 using Sage.ES.S50.UnitTest.Mock;
17 using sage.ew.interficies;
18 
19 namespace Sage.ES.S50.UnitTest
20 
21 {
29  static partial class ExtensionesTest
30  {
31  #region Extensiones de entorno de test
32 
33  //private static TestContext _contexto = null;
34  private static bool _CargaEjecutada = false;
35 
40  public static void __Test_LoadRandomConfig(this TestContext toContexto)
41  {
42  //Stopwatch timer = new Stopwatch();
43  //timer.Start();
44 
45  if (_CargaEjecutada)
46  {
47  //Este método tiene una penalización brutal (30-60seg) y se ejecuta por cada clase de preuba
48  //con el objetivo de garantizar una configuración cargada... Este objetivo se consige la primera vez
49  //para el resto de clases de prueba que se ejecuten en el mismo bloque no es necesario y no aporta nada
50 
51  //Pruebo de cargar un valor
52  var claveDePruebaPresente = Convert.ToBoolean(EW_GLOBAL._GetVariable("wl_ConfigUnitTestLoaded", false));
53  if (claveDePruebaPresente)
54  {
55  return;
56  }
57  }
58 
59  __Test_LoadRandomConfigWithoutDictionary(toContexto);
60  //toContexto.WriteLine($"LoadRandomConfig sin diccionarios {timer.ElapsedMilliseconds} ms");
61 
62  // Bajar fichero Sagelic
63  LICENCIAS._ObtenerLicenciaActual();
64  if (!LICENCIAS._Validar_Licencia_Suscripcion())
65  Assert.Fail("Error al validar la licencia de suscripción.");
66  //toContexto.WriteLine($"LoadRandomConfig validada la licencia {timer.ElapsedMilliseconds} ms");
67 
68  _CargaEjecutada = true;
69  EW_GLOBAL.ValorEnClave_VarGlob("wl_ConfigUnitTestLoaded", true);
70 
71 
72  }
73  public static void __Test_LoadRandomConfigWithoutDictionary(this TestContext toContexto)
74  {
75  string lcEmpresa = System.Configuration.ConfigurationManager.AppSettings["_Empresa"].ToString();
76  string lcCaja = System.Configuration.ConfigurationManager.AppSettings["_Caja"].ToString();
77  string lcXmlConfig = System.Configuration.ConfigurationManager.AppSettings["_XmlConfig"].ToString();
78 
80  __Test_SQLConnect(toContexto);
81  if (string.IsNullOrWhiteSpace(lcEmpresa))
82  lcEmpresa = EmpresaAleatoria(toContexto);
83  if (string.IsNullOrWhiteSpace(lcCaja))
84  lcCaja = CajaAleatoria(toContexto);
85 
86  string dirName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
87  EW_GLOBAL.ValorEnClave_VarGlob("wl_sage50", true); // PE-97745
88  EW_GLOBAL.ValorEnClave_VarGlob("wc_usuario", "SUPERVISOR"); //Asignar usuario SUPERVISOR, en este punto el usuario actual es SUPERVISOR_NET
89  EW_GLOBAL.ValorEnClave_VarGlob("wc_pathinicio", dirName);
90  EW_GLOBAL.ValorEnClave_VarGlob("wc_iniservidor", dirName);
91  EW_GLOBAL.ValorEnClave_VarGlob("wn_TipoProd", 2);
92 
93  InitializeDependencyInjectionMock();
94 
95  //Cargo diccionarios
96  DiccionariosLoader.CargarDiccionarios(lcEmpresa, lcCaja);
97 
98  if (!string.IsNullOrWhiteSpace(lcXmlConfig) && File.Exists(lcXmlConfig))
99  EW_GLOBAL._CargarVarExtra(lcXmlConfig);
100 
101  LoadAddons();
102 
103  EW_GLOBAL._Empresa = new sage.ew.empresa.Empresa(Convert.ToString(EW_GLOBAL._GetVariable("wc_empresa")));
104  }
105  public static void __Test_SQLConnect( this TestContext toContexto)
106  {
107  string lcServer = System.Configuration.ConfigurationManager.AppSettings["_Server"].ToString();
108  string lcUser = System.Configuration.ConfigurationManager.AppSettings["_User"].ToString();
109  string lcPass = System.Configuration.ConfigurationManager.AppSettings["_Pass"].ToString();
110  string lcComunes = System.Configuration.ConfigurationManager.AppSettings["_Comunes"].ToString();
111 
112  if (DB.SQLChangeConnection("eurowin"))
113  return;
114 
115  // Cargar diccionarios ESTANDARD 8.0
116  DB.SQLConnect(lcServer, lcUser, lcPass, lcComunes, tcAliasConexion: "eurowin");
117 
118  }
119  public static void LoadAddons()
120  {
121  string dirName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
122  EW_GLOBAL.ValorEnClave_VarGlob("wc_pathinicio", dirName);
123  EW_GLOBAL.ValorEnClave_VarGlob("wc_iniservidor", dirName);
125  {
126  GenerarChecksumOpciones = Criptografia.GenerarChecksumOpciones,
127  GetSage50PathLibrerias = FUNCTIONS.GetSage50PathLibrerias,
128  CodigoLicencia = LICENCIAS._CodigoLicencia
129  }
130  );
131 
132  // Esperar a finalizar la carga asincrona de los addons
134  if (!addonsCargados)
135  {
136  Assert.Fail(DiccionarioFactory.GetDiccionarioGlobal().GetValue("error_carga_addons").ToString());
137  }
138  }
139 
150  public static string __FieldAleatorioNew(this TestContext toContexto, string tcDataBase, string tcTable, string tcField = "CODIGO", int tnLenCampoEntero = 9)
151  {
152  int lnLen = 0, lnMax = 0, lnCont = 0;
153  bool lltrobat = false;
154  DataTable ldtTemp = new DataTable();
155  string lcCodigo = string.Empty;
156  string lcSql = "SELECT a.*,b.name as tipo_campo "
157  + " FROM " + DB.SQLDatabase(tcDataBase, "columns", true) + " as a inner join " + DB.SQLDatabase(tcDataBase, "types", true) + " as b on a.system_type_id=b.system_type_id "
158  + " WHERE [object_id] = (select object_id from " + DB.SQLDatabase(tcDataBase, "tables", true) + " as c where c.name=" + DB.SQLString(tcTable) + ") AND a.name=" + DB.SQLString(tcField) + ";";
159  DB.SQLExec(lcSql, ref ldtTemp);
160 
161  if (ldtTemp != null && ldtTemp.Rows.Count > 0)
162  {
163  if (ldtTemp.Rows[0]["tipo_campo"].ToString().Contains("char") || ldtTemp.Rows[0]["tipo_campo"].ToString().Contains("text"))
164  {
165  //Campo de tipo string
166  System.Reflection.PropertyInfo loPropiedad = typeof(String).GetType().GetProperty("Chars");
167  if (ldtTemp.Rows[0]["tipo_campo"].ToString().Contains("text"))
168  lnLen = Int32.MaxValue; //lenght for text fields
169  else
170  lnLen = Convert.ToInt32(ldtTemp.Rows[0]["max_length"].ToString());
171 
172  lnMax = (lnLen == Int32.MaxValue) ? 1000 : (int)Math.Pow(10, lnLen) - 1;
173 
174  do
175  {
176  lltrobat = false;
177  //dynamic loNuevo = loPropiedad.__Get_Random_Value();
178  lcCodigo = Guid.NewGuid().ToString().ToUpper();
179  if (lcCodigo.Length > lnLen)
180  lcCodigo = lcCodigo.Substring(0, lnLen);
181  string loTemp = DB.SQLValor(tcTable, tcField, lcCodigo, tcField, tcDataBase).ToString();
182  if (!string.IsNullOrWhiteSpace(loTemp))
183  lltrobat = true;
184 
185  ++lnCont;
186  if (lnCont > lnMax)
187  {
188  lcCodigo = string.Empty;
189  lltrobat = false;
190  }
191 
192  } while (lltrobat);
193 
194  }
195  else if (ldtTemp.Rows[0]["tipo_campo"].ToString().Contains("int"))
196  {
197  //Campo de tipo numérico
198  Random r = new Random();
199  //lnLen = Convert.ToInt32(ldtTemp.Rows[0]["max_length"].ToString());
200  lnLen = tnLenCampoEntero > 0 ? tnLenCampoEntero : 9;
201  lnMax = (int)Math.Pow(10, lnLen) - 1;
202  do
203  {
204  lltrobat = false;
205  lcCodigo = r.Next(0, Int32.MaxValue).ToString();
206  if (lcCodigo.Length > lnLen)
207  lcCodigo = lcCodigo.Substring(0, lnLen);
208  string loTemp = DB.SQLValor(tcTable, tcField, lcCodigo, tcField, tcDataBase).ToString();
209  if (!string.IsNullOrWhiteSpace(loTemp) && loTemp != "0")
210  lltrobat = true;
211 
212  ++lnCont;
213  if (lnCont > lnMax)
214  {
215  lcCodigo = string.Empty;
216  lltrobat = false;
217  }
218 
219 
220  } while (lltrobat);
221  }
222  }
223 
224  return lcCodigo;
225  }
226 
234  public static string __FieldAleatorio(this TestContext toContexto, string tcDataBase, string tcTable, string tcField = "CODIGO")
235  {
236  string lcCodigoAleatoria = string.Empty;
237  bool llOk = false;
238  string lcSql = string.Empty;
239  DataTable ldtResult = new DataTable();
240 
241  lcSql = "SELECT " + tcField + " FROM " + DB.SQLDatabase(tcDataBase, tcTable) + " WHERE " + tcField + " <> ''";
242  llOk = DB.SQLExec(lcSql, ref ldtResult);
243  if (llOk && ldtResult.Rows.Count > 0)
244  {
245  int lnMax = ldtResult.Rows.Count;
246  Random loRand = new Random();
247  int lnRandomIndex = loRand.Next(0, lnMax);
248 
249  lcCodigoAleatoria = ldtResult.Rows[lnRandomIndex][tcField].ToString();
250  }
251  //else Assert.Fail(tcTable + ": No se ha podido establecer un entorno para el test.");
252 
253  return lcCodigoAleatoria;
254  }
255 
265  public static object __FieldDatabase(this TestContext toContexto, string tcDataBase, string tcTable, string valueFiltro, string tcFieldFiltro = "CODIGO", string tcFieldReturn = "NOMBRE")
266  {
267  object oFieldValue = new object();
268  bool llOk = false;
269  string lcSql = string.Empty;
270  DataTable ldtResult = new DataTable();
271 
272  lcSql = "SELECT " + tcFieldReturn + " FROM " + DB.SQLDatabase(tcDataBase, tcTable) + " WHERE " + tcFieldFiltro + " = '" + valueFiltro.Trim() + "'";
273  llOk = DB.SQLExec(lcSql, ref ldtResult);
274  if (llOk && ldtResult.Rows.Count > 0)
275  {
276  oFieldValue = ldtResult.Rows[0][tcFieldReturn];
277  }
278  //else Assert.Fail(tcTable + ": No se ha podido establecer un entorno para el test.");
279 
280  return oFieldValue;
281  }
282 
287  public static string __AnteriorEjercicio(this TestContext toContexto)
288  {
289  return DB._AnteriorEjercicio();
290  }
291 
296  public static string __SiguienteEjercicio(this TestContext toContexto)
297  {
298  return DB._SiguienteEjercicio();
299  }
300 
305  public static string __ActualEjercicio(this TestContext toContexto)
306  {
307  return DB.Ejercicio_EW;
308  }
309 
314  public static bool __EsPenultimoEjercicio(this TestContext toContexto)
315  {
316  return DB._EsPenultimoEjercicio();
317  }
318 
323  private static string EmpresaAleatoria(this TestContext toContexto)
324  {
325  return toContexto.__FieldAleatorio("GESTION", "EMPRESA", "CODIGO");
326  }
327 
332  private static string CajaAleatoria(this TestContext toContexto)
333  {
334  return toContexto.__FieldAleatorio("TPV", "CAJAS", "CODIGO");
335  }
336 
337  #endregion Extensiones de entorno de test
338 
339 
345  public static void __Test_MayorQueZero(this Control toControl, string tcNombrePropiedad)
346  {
347  //Recupero la propiedad
348  System.Reflection.PropertyInfo loPropiedades = toControl.GetType().GetProperty(tcNombrePropiedad);
349 
350  //Validaciones de tipo de datos (espero un INT o un DECIMAL)
351  bool llTipoCorrecto = false;
352  //Espero tipos Decimal o Int32... pero es ampliable a otros tipos
353  llTipoCorrecto = (loPropiedades.PropertyType.Name == "Decimal" || loPropiedades.PropertyType.Name == "Int32");
354  Assert.AreEqual<bool>(llTipoCorrecto, true, "Tipo " + loPropiedades.PropertyType.Name + " no contemplado para unit test genericas.");
355 
356  dynamic lnDefault = (dynamic)loPropiedades.GetValue(toControl, null);
357  dynamic lnZero = 0, lnNegativo = 0, lnPositivo = 0;
358  dynamic lnActual;
359 
360  switch (loPropiedades.PropertyType.Name)
361  {
362  case "Decimal":
363  lnZero = 0M;
364  lnNegativo = -20M;
365  lnPositivo = 20M;
366  break;
367 
368  case "Int16":
369  case "Int32":
370  case "Int64":
371  lnZero = 0;
372  lnNegativo = -20;
373  lnPositivo = 20;
374  break;
375  }
376 
377 
378  //Valor 0
379  loPropiedades.SetValue(toControl, lnZero, null);
380  lnActual = (dynamic)loPropiedades.GetValue(toControl, null);
381  Assert.AreNotEqual<dynamic>(lnActual, lnZero, "Propiedad " + tcNombrePropiedad + " admite un valor 0");
382 
384  loPropiedades.SetValue(toControl, lnNegativo, null);
385  lnActual = (dynamic)loPropiedades.GetValue(toControl, null);
386  Assert.AreNotEqual<dynamic>(lnActual, lnNegativo, "Propiedad " + tcNombrePropiedad + " admite negativos");
387 
388  lnPositivo = 20;
389  loPropiedades.SetValue(toControl, lnPositivo, null);
390  lnActual = (dynamic)loPropiedades.GetValue(toControl, null);
391  Assert.AreEqual<dynamic>(lnActual, lnPositivo, "Propiedad " + tcNombrePropiedad + " no asigna correctamente el valor");
392  }
393 
399  public static void __Test_SoloGET<T>(this Control toControl, string tcNombrePropiedad)
400  {
401  //Recupero la propiedad
402  System.Reflection.PropertyInfo loPropiedades = toControl.GetType().GetProperty(tcNombrePropiedad);
403 
404  //Me guardo el valor inicial
405  dynamic loDefault = loPropiedades.GetValue(toControl, null);
406  //Creo un nuevo valor
407  dynamic loNuevo = loPropiedades.__Get_Random_Value();
408 
409  //Me aseguro de que sea distinto
410  while (Equals(loDefault, loNuevo))
411  {
412  loNuevo = loPropiedades.__Get_Random_Value();
413  }
414 
415  //Asigno el nuevo valor
416  try
417  {
418  loPropiedades.SetValue(toControl, loNuevo, null);
419  Assert.Fail("No se ha disparado excepción al hacer un SET => Existe dicho método para la propiedad");
420  }
421  catch (ArgumentException loException)
422  {
423  //Se ha de producir EXACTAMENTE esta excepción
424  Assert.AreEqual("No se puede encontrar el método Set de la propiedad.", loException.Message);
425  }
426  catch (Exception loException)
427  {
428  Assert.Fail(string.Format("Excepción inesperada del tipo {0} mensage: {1}", loException.GetType(), loException.Message));
429  }
430 
432  //dynamic loActual = (dynamic)loPropiedades.GetValue(toControl, null);
433 
435  //Assert.AreNotEqual<dynamic>(loActual, loNuevo, "La propiedad " + tcNombrePropiedad + " admite hacer un SET del valor");
436  }
437 
443  public static void __Test_GetSetValue(this Control toControl, string tcNombrePropiedad, object toTestValue = null)
444  {
445  //Recupero la propiedad
446  System.Reflection.PropertyInfo loPropiedad = toControl.GetType().GetProperty(tcNombrePropiedad);
447 
448  //Miro si he recibido un valor para realizar el test
449  if (toTestValue == null)
450  {
451  //Me guardo el valor inicial
452  object loDefault = loPropiedad.GetValue(toControl, null);
453  //Creo un nuevo valor
454  object loNuevo = loPropiedad.__Get_Random_Value();
455 
456  //Me aseguro de que sea distinto
457  while (Equals(loDefault, loNuevo))
458  {
459  loNuevo = loPropiedad.__Get_Random_Value();
460  }
461 
462  //Asigno el nuevo valor
463  loPropiedad.SetValue(toControl, loNuevo, null);
464 
465  //Recupero el valor actual
466  dynamic loActual = loPropiedad.GetValue(toControl, null);
467  Assert.IsFalse(Equals(loDefault, loActual), "El valor actual es igual al inicial. Revisar que no haya restricciones al hacer un SET de la propiedad." + Environment.NewLine +
468  "De ser así utiliza el parámetro opcional para suministrar un valor que cumpla las restricciones.");
469 
470  //El valor actual ha de ser igual al nuevo
471  Assert.AreEqual<dynamic>(loActual, loNuevo, "La propiedad " + tcNombrePropiedad + " no realiza correctamente operaciones de GET y SET");
472 
473  //Si la propiedad es de tipo texto la longitud ha de ser igual
474  if (loPropiedad.PropertyType.FullName == "System.String")
475  Assert.AreEqual<int>(((string)loActual).Length, ((string)loNuevo).Length, "La longitud no concuerda.");
476  }
477  else //Utilizo el valor recibido
478  {
479  //Asigno el valor recibido
480  loPropiedad.SetValue(toControl, toTestValue, null);
481  //Recupero el valor actual
482  dynamic loActual = loPropiedad.GetValue(toControl, null);
483 
484  //El valor actual ha de ser igual al nuevo
485  Assert.AreEqual<dynamic>(loActual, toTestValue, "La propiedad " + tcNombrePropiedad + " no realiza correctamente operaciones de GET y SET");
486  }
487 
488 
489  }
490 
491  public static void __Test_NumericUpDownBasics(this Control toControl)
492  {
493  //Testeo clase base
494  bool llOk = (toControl is sage.ew.objetos.ewnumericupdown);
495  Assert.AreEqual<bool>(true, llOk, "La clase del objeto no es ewNumericUpDown.");
496 
497  //Testeo propiedades minimas.
498  Assert.AreEqual<bool>(false, ((sage.ew.objetos.ewnumericupdown)toControl).ThousandsSeparator, "Separador de miles activado.");
499  Assert.AreEqual(System.Windows.Forms.HorizontalAlignment.Right, ((sage.ew.objetos.ewnumericupdown)toControl).TextAlign, "Alineamiento de texto incorrecto.");
500  }
501 
507  private static object __Get_Random_Value(this System.Reflection.PropertyInfo toPropiedad)
508  {
509  Random loRandom;
510 
511  switch (toPropiedad.PropertyType.FullName)
512  {
513  case "System.String":
514  case "System.Guid":
515  return Guid.NewGuid().ToString();
516  case "System.Int32":
517  loRandom = new Random();
518  return loRandom.Next();
519  case "System.Char":
520  loRandom = new Random();
521  int lnNum = loRandom.Next(0, 26); // de Zero a 25
522  return (char)('a' + lnNum);
523  case "System.Boolean":
524  loRandom = new Random();
525  return loRandom.Next(0, 2) == 0;
526  case "System.Decimal":
527  loRandom = new Random();
528  int lnPrecision = loRandom.Next(1,28);
529  int lnEscala = loRandom.Next(0, lnPrecision);
530  decimal lnDecimal = 0M;
531 
532  for (int lnIndPres = 0; lnIndPres < lnPrecision; lnIndPres++)
533  {
534  int lnDigito = loRandom.Next(0, 10);
535  lnDecimal = lnDecimal * 10M + lnDigito;
536  }
537  for (int lnIndEsc = 0; lnIndEsc < lnEscala; lnIndEsc++)
538  {
539  lnDecimal /= 10M;
540  }
541  return lnDecimal;
542 
543  default:
544  //Pruebo de buscar el tipo
545  Type elementType = _GetType(toPropiedad.PropertyType.FullName);
546  if (elementType != null)
547  {
548  //Creem una instancia del objecte
549  return Activator.CreateInstance(elementType);
550  }
551  break;
552  }
553  return null;
554  }
555 
562  private static Type _GetType(string typeName, bool tlBuscarControles = false)
563  {
564  var type = Type.GetType(typeName);
565  if (type != null) return type;
566 
567  if (!tlBuscarControles) //Busca clases
568  {
569  foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
570  {
571  type = a.GetType(typeName);
572  if (type != null)
573  return type;
574  }
575  }
576  else
577  {
578  foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
579  {
580  //Busco directamente por si el tipo me viene informado al completo
581  type = a.GetType(typeName);
582  if (type != null) return type;
583  //Especulo a ver si la dll en la que me encuentro tiene el tipo deseado
584  type = a.GetType(a.GetName().Name + "." + typeName);
585  if (type != null) return type;
586  //Especulo a ver si la dll en la que me encuentro tiene en UserControls el tipo deseado
587  type = a.GetType(a.GetName().Name + ".UserControls." + typeName);
588  if (type != null) return type;
589  //Especulo a ver si la dll en la que me encuentro tiene en UserControls el tipo deseado
590  type = a.GetType(a.GetName().Name + ".Clases." + typeName);
591  if (type != null) return type;
592  }
593  }
594  return null;
595  }
596  public static void InitializeDependencyInjectionMock()
597  {
598  IRegisterTypes registerTypesSage50 = new RegisterTypesSage50Mock();
599  registerTypesSage50.RegisterTypes();
600  //DependencyInjector.Instance.RegisterTypes(RegisterType.All);
601  EW_GLOBAL.ValorEnClave_VarGlob("wl_sage50", true);
602  }
603  //public static void InitializeDependencyInjectionAddonsMock()
604  //{
605  // IRegisterTypes registerTypesAddons = new RegisterTypesAddonsMock();
606  // registerTypesAddons.RegisterTypes();
607  //}
608  #region Extensiones para tipo OBJECT
609 
616  public static void __Test_GetSetValue(this Object toObjeto, string tcNombrePropiedad, object toTestValue = null)
617  {
618  //Recupero la propiedad
619  System.Reflection.PropertyInfo loPropiedad = toObjeto.GetType().GetProperty(tcNombrePropiedad);
620 
621  //Miro si he recibido un valor para realizar el test
622  if (toTestValue == null)
623  {
624  //Me guardo el valor inicial
625  object loDefault = loPropiedad.GetValue(toObjeto, null);
626  //Creo un nuevo valor
627  object loNuevo = loPropiedad.__Get_Random_Value();
628 
629  //Me aseguro de que sea distinto
630  while (Equals(loDefault, loNuevo))
631  {
632  loNuevo = loPropiedad.__Get_Random_Value();
633  }
634 
635  //Asigno el nuevo valor
636  loPropiedad.SetValue(toObjeto, loNuevo, null);
637 
638  //Recupero el valor actual
639  dynamic loActual = loPropiedad.GetValue(toObjeto, null);
640  Assert.IsFalse(Equals(loDefault, loActual), "El valor actual es igual al inicial. Revisar que no haya restricciones al hacer un SET de la propiedad." + Environment.NewLine +
641  "De ser así utiliza el parámetro opcional para suministrar un valor que cumpla las restricciones.");
642 
643  //El valor actual ha de ser igual al nuevo
644  if (loPropiedad.PropertyType.FullName == "System.Decimal")
645  {
646  //PE-94722 Determino la precisión decimal
647  int lnNumDecimales = BitConverter.GetBytes(decimal.GetBits((decimal)loActual)[3])[2];
648  Assert.AreEqual<dynamic>(loActual, Decimal.Round((decimal)loNuevo, lnNumDecimales), "La propiedad " + tcNombrePropiedad + " no realiza correctamente operaciones de GET y SET");
649  }
650  else
651  Assert.AreEqual<dynamic>(loActual, loNuevo, "La propiedad " + tcNombrePropiedad + " no realiza correctamente operaciones de GET y SET");
652 
653 
654  //Si la propiedad es de tipo texto la longitud ha de ser igual
655  if (loPropiedad.PropertyType.FullName == "System.String")
656  Assert.AreEqual<int>(((string)loActual).Length, ((string)loNuevo).Length, "La longitud no concuerda.");
657  }
658  else //Utilizo el valor recibido
659  {
660  //Asigno el valor recibido
661  loPropiedad.SetValue(toObjeto, toTestValue, null);
662  //Recupero el valor actual
663  dynamic loActual = loPropiedad.GetValue(toObjeto, null);
664 
665  //El valor actual ha de ser igual al nuevo
666  Assert.AreEqual<dynamic>(loActual, toTestValue, "La propiedad " + tcNombrePropiedad + " no realiza correctamente operaciones de GET y SET");
667  }
668  }
669 
670  #endregion Extensiones para tipo OBJECT
671 
672  }
673 }
static string GenerarChecksumOpciones(string tcOpcion, string tcSalt)
PE-102978: Generar una función hash segura a partir de una opción y un salt
Classe empresa basada en sage.ew.ewmante
Definition: clsEmpresa.cs:48
static AddonsController Instance
Instancia al objeto singleton Addons
Argumentos para los eventos lanzados por el addons en caso de error
bool _CargarAddOns(FunctionsDependencies loFuntionsDependencies)
Carga addons
Clase Singleton para la carga de los diccionarios
Clase sage.ew.objetos.ewnumericupdown
PE-85105: Clase donde se implementaran aquellas funciones de encriptación y desencriptación utilizand...
Definition: Criptografia.cs:15
Interfaz de registro de tipos
static bool CargarDiccionarios(string tcempresa, string tcCajaTpv)
A partir de un código de empresa y un código de caja nos carga las variables de empresa, mascaras, anchuras de campos standar y de TPV
static IDiccionarioGlobal GetDiccionarioGlobal()
obtiene una instancia a diccionario global
Factoria de diccionarios estáticos
void RegisterTypes()
Registra tipos
IAddonsManager AddonsManager
Gestor de Addons
bool _CargarAddons_WaitAll()
Esperar a que se hayan cargado todos los addons