public void TestErrorLetra() { var target = new Nie(); target.NumeroDocumento = "X0223150J"; var result = target.NumeroDocumento; }
public void TestErrorLongitud() { var target = new Nie(); target.NumeroDocumento = "22222223453534"; var result = target.NumeroDocumento; }
public void TestComprobarLetraNie() { var target = new Nie(); target.NumeroDocumento = "X0223150G"; var result = target.NumeroDocumento; Assert.AreEqual("X0223150G", result); }
public void NieKos(string value) { Nie.Create(value).IsValid().Should().BeFalse(); }
public void NieOks(string value) { Nie.Create(value).IsValid().Should().BeTrue(); }
/// <summary> </summary> /// <returns></returns> public bool IsValid() { return(Dni.Create(Value).IsValid() || Nie.Create(Value).IsValid()); }
public void TestNie() { var target = new Nie { Pais = "Nigeria" }; }
public void TestContext() { var target = new GpContext(); { try { // Your code... // Could also be before try if you know the exception occurs in SaveChanges /* var persona = new Persona(); * persona.FechaNacimiento = new DateTime(); */ var persona = new Persona { FechaNacimiento = new DateTime(2000, 09, 01) }; target.Personas.Add(persona); target.SaveChanges(); var policia = new Policia { NumeroPlaca = 5 }; target.Policias.Add(policia); target.SaveChanges(); var detenido = new Detenido { FechaDetencion = new DateTime(2000, 02, 01) }; target.Detenidos.Add(detenido); target.SaveChanges(); var usuario = new Usuario(); target.Usuarios.Add(usuario); target.SaveChanges(); var dni = new Dni() { NumeroDocumento = "56904819" }; target.Dnis.Add(dni); target.SaveChanges(); var nie = new Nie() { NumeroDocumento = "Z5164919K" }; target.Nies.Add(nie); target.SaveChanges(); var pasaporte = new Pasaporte() { NumeroDocumento = "C35890664" }; target.Pasaportes.Add(pasaporte); target.SaveChanges(); var policias = target.Policias.Count(); var policias2 = target.Personas.OfType <Policia>().Count(); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine( "Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } } catch (Exception ex) { } } }