Commit 67491a5 1 parent 4a97e43 commit 67491a5 Copy full SHA for 67491a5
File tree 2 files changed +85
-0
lines changed
2 files changed +85
-0
lines changed Original file line number Diff line number Diff line change @@ -2934,4 +2934,43 @@ public void CanRemovePropertyTogetherWithClass()
2934
2934
Assert . Equal ( 42 , root . I ) ;
2935
2935
}
2936
2936
}
2937
+
2938
+ public interface IFace
2939
+ {
2940
+ int I { get ; set ; }
2941
+ }
2942
+
2943
+ public class ObjFace : IFace
2944
+ {
2945
+ public int I { get ; set ; }
2946
+ }
2947
+
2948
+ public class RootObj
2949
+ {
2950
+ public IFace O { get ; set ; }
2951
+ public int I { get ; set ; }
2952
+ }
2953
+
2954
+ [ Fact ]
2955
+ public void CanRemoveDerivedClassWhenPropertyWithBaseClassExists ( )
2956
+ {
2957
+ _db . RegisterType ( typeof ( RootObj ) ) ;
2958
+ _db . RegisterType ( typeof ( ObjFace ) ) ;
2959
+ using ( var tr = _db . StartTransaction ( ) )
2960
+ {
2961
+ var root = tr . Singleton < RootObj > ( ) ;
2962
+ root . I = 42 ;
2963
+ root . O = new ObjFace { I = 5 } ;
2964
+ tr . Commit ( ) ;
2965
+ }
2966
+
2967
+ ReopenDb ( ) ;
2968
+ _db . RegisterType ( typeof ( RootObj ) ) ;
2969
+ using ( var tr = _db . StartTransaction ( ) )
2970
+ {
2971
+ var root = tr . Singleton < RootObj > ( ) ;
2972
+ Assert . Equal ( 42 , root . I ) ;
2973
+ Assert . Null ( root . O ) ;
2974
+ }
2975
+ }
2937
2976
}
Original file line number Diff line number Diff line change @@ -1061,4 +1061,50 @@ public void CanRemovePropertyTogetherWithClass()
1061
1061
Assert . Equal ( 43 , root . After ) ;
1062
1062
}
1063
1063
}
1064
+
1065
+ public interface IFace
1066
+ {
1067
+ int I { get ; set ; }
1068
+ }
1069
+
1070
+ public class ObjFace : IFace
1071
+ {
1072
+ public int I { get ; set ; }
1073
+ }
1074
+
1075
+ public class RootObj
1076
+ {
1077
+ public IFace O { get ; set ; }
1078
+ public int I { get ; set ; }
1079
+ }
1080
+
1081
+ public interface IRootObjTable : IRelation < RootObj >
1082
+ {
1083
+ }
1084
+
1085
+ [ Fact ]
1086
+ public void CanRemoveDerivedClassWhenPropertyWithBaseClassExists ( )
1087
+ {
1088
+ _db . RegisterType ( typeof ( ObjFace ) ) ;
1089
+ using ( var tr = _db . StartTransaction ( ) )
1090
+ {
1091
+ var t = tr . GetRelation < IRootObjTable > ( ) ;
1092
+ var root = new RootObj
1093
+ {
1094
+ I = 42 ,
1095
+ O = new ObjFace { I = 5 }
1096
+ } ;
1097
+ t . Upsert ( root ) ;
1098
+ tr . Commit ( ) ;
1099
+ }
1100
+
1101
+ ReopenDb ( ) ;
1102
+ using ( var tr = _db . StartTransaction ( ) )
1103
+ {
1104
+ var t = tr . GetRelation < IRootObjTable > ( ) ;
1105
+ var root = t . First ( ) ;
1106
+ Assert . Equal ( 42 , root . I ) ;
1107
+ Assert . Null ( root . O ) ;
1108
+ }
1109
+ }
1064
1110
}
You can’t perform that action at this time.
0 commit comments