Beispiel #1
0
 public void SetPrimaryKeyValueWorks() {
     var map = new Map<Post>();
     map.Columns.Add("PostId", new Column<int> { IsPrimaryKey = true, Map = map, Name = "PostId" });
     map.PrimaryKey = map.Columns["PostId"];
     var post = new Post { PostId = 123 };
     map.SetPrimaryKeyValue(post, 256);
     Assert.Equal(256, post.PostId);
 }
Beispiel #2
0
 public void UsePrimaryKeySetterWithoutPrimaryKeyColumnThrow() {
     var map = new Map<Post>();
     map.Columns.Add("PostId", new Column<int> { IsPrimaryKey = true, Map = map, Name = "PostId" });
     var post = new Post { PostId = 123 };
     Assert.Throws<Exception>(() => map.SetPrimaryKeyValue(post, 123));
 }