@@ -19,33 +19,8 @@ public partial class DbContextTests
1919 [ Order ( 0 ) ]
2020 public void ShouldBeAbleToInsertOnePersonRecordWithNoUDTT ( )
2121 {
22- string expected_cmd = @"INSERT INTO [dbo].[Person]
23- OUTPUT INSERTED.* INTO @output
24- VALUES
25- (@FirstName, @MiddleInitial, @FamilyName)" ;
26-
2722 Models . Person person = GetFakePerson . Generate ( ) ;
28-
29- Context . Database . Instance . AddCommandBehavior ( expected_cmd , cmd =>
30- {
31- Models . Person data = new Models . Person ( )
32- {
33- FamilyName = cmd . Parameters [ "@FamilyName" ] . Value . ToString ( ) ,
34- FirstName = cmd . Parameters [ "@FirstName" ] . Value . ToString ( ) ,
35- MiddleInitial = cmd . Parameters [ "@MiddleInitial" ] . Value . IsNotNull ( x => x . ToString ( ) )
36- } ;
37-
38- People . Add ( data ) ;
39-
40- data . ID = People . Count ;
41-
42- data . FullName = String . Format ( "{0}, {1}{2}" ,
43- data . FamilyName , data . FirstName ,
44- string . IsNullOrEmpty ( data . MiddleInitial ? . Trim ( ) ) ? "" : $ " { data . MiddleInitial } .") ;
45-
46- return new [ ] { data } . ToDataTable ( ) ;
47- } ) ;
48-
23+
4924 Context . People . Add ( person ) ;
5025
5126 Context . ChangeTracking . SelectMany ( x => x . Value ) . Count ( x => x . IsNew ) . Should ( ) . Be ( 1 ) ;
@@ -187,33 +162,6 @@ OUTPUT INSERTED.* INTO @output
187162 new Models . Person ( ) { FirstName = "First_4" , FamilyName = "Last_4" , FullName = "First_4 Last_4" }
188163 } ;
189164
190- Context . Database . Instance . AddCommandBehavior ( expected_cmd , cmd =>
191- {
192- cmd . Parameters [ "@MiddleInitial" ] . DbType . Should ( ) . Be ( DbType . AnsiString ) ;
193-
194- Models . Person [ ] _persons = new [ ]
195- {
196- new Models . Person ( )
197- {
198- FamilyName = cmd . Parameters [ "@FamilyName" ] . Value . ToString ( ) ,
199- FirstName = cmd . Parameters [ "@FirstName" ] . Value . ToString ( ) ,
200- MiddleInitial = cmd . Parameters [ "@MiddleInitial" ] . Value . IsNotNull ( x => x . ToString ( ) )
201- }
202- } ;
203-
204- foreach ( var person in _persons )
205- {
206- People . Add ( person ) ;
207-
208- person . ID = People . Count ;
209- person . FullName = String . Format ( "{0}, {1}{2}" ,
210- person . FamilyName , person . FirstName ,
211- person . MiddleInitial . IsNotNullOrEmpty ( ) ? $ " { person . MiddleInitial } ." : "" ) ;
212- }
213-
214- return _persons . ToDataTable ( ) ;
215- } ) ;
216-
217165 Context . People . AddRange ( people ) ;
218166
219167 Context . ChangeTracking . SelectMany ( x => x . Value ) . Count ( x => x . IsNew ) . Should ( ) . Be ( 3 ) ;
@@ -330,17 +278,6 @@ public void ShouldBeAbleToInsertRenterWithCompositeKey(bool withUDTT, string exp
330278
331279 renters . CopyTo ( original , 0 ) ;
332280
333- //if (!withUDTT)
334- //{
335- // // ubunto and windows format dates very differently
336- // for (int i = 0; i < renters.Length; i++)
337- // {
338- // expected = expected
339- // .Replace($"[StartDate_{i}]", renters[i].StartDate.ToString())
340- // .Replace($"[EndDate_{i}]", renters[i].EndDate.ToString());
341- // }
342- //}
343-
344281 Context . Database . Instance . AddCommandBehavior ( expected , cmd =>
345282 {
346283 if ( withUDTT )
0 commit comments