Ejemplo n.º 1
0
 public void TestEntityKeyRequiredExceptionWhenIdIsNull()
 {
     using (var context = GetContext())
     {
         var entity = new StringKeyEntity();
         context.StringKeyEntities.Add(entity);
     }
 }
Ejemplo n.º 2
0
 public void TestEntityKeyRequiredExceptionWhenIdIsEmptyString()
 {
     using (var context = GetContext())
     {
         var entity = new StringKeyEntity {
             Name = ""
         };
         context.StringKeyEntities.Add(entity);
     }
 }
Ejemplo n.º 3
0
 public void TestCreateStringKeyEntity()
 {
     using (var context = GetContext())
     {
         var entity = new StringKeyEntity {Name = "Entity1", Description = "This is Entity 1"};
         context.StringKeyEntities.Add(entity);
         context.SaveChanges();
     }
     using (var context = GetContext())
     {
         var entity = context.StringKeyEntities.FirstOrDefault(x => x.Id.Equals("Entity1"));
         Assert.That(entity, Is.Not.Null);
         Assert.That(entity.Name, Is.EqualTo("Entity1"));
         Assert.That(entity.Description, Is.EqualTo("This is Entity 1"));
     }
 }
Ejemplo n.º 4
0
 public void TestCreateStringKeyEntity()
 {
     using (var context = GetContext())
     {
         var entity = new StringKeyEntity {
             Name = "Entity1", Description = "This is Entity 1"
         };
         context.StringKeyEntities.Add(entity);
         context.SaveChanges();
     }
     using (var context = GetContext())
     {
         var entity = context.StringKeyEntities.FirstOrDefault(x => x.Id.Equals("Entity1"));
         Assert.That(entity, Is.Not.Null);
         Assert.That(entity.Name, Is.EqualTo("Entity1"));
         Assert.That(entity.Description, Is.EqualTo("This is Entity 1"));
     }
 }
Ejemplo n.º 5
0
 public void TestEntityKeyRequiredExceptionWhenIdIsEmptyString()
 {
     using (var context = GetContext())
     {
         var entity = new StringKeyEntity{Name=""};
         context.StringKeyEntities.Add(entity);
     }
     
 }
Ejemplo n.º 6
0
 public void TestEntityKeyRequiredExceptionWhenIdIsNull()
 {
     using (var context = GetContext())
     {
         var entity = new StringKeyEntity();
         context.StringKeyEntities.Add(entity);
     }
 }