11using System ;
22using System . Diagnostics ;
3- using System . Linq ;
43using NUnit . Framework ;
54using UnitOfWork . NET . EntityFramework . Classes ;
6- using UnitOfWork . NET . EntityFramework . Interfaces ;
75using UnitOfWork . NET . EntityFramework . NUnit . Classes ;
86using UnitOfWork . NET . EntityFramework . NUnit . Data . Models ;
97using UnitOfWork . NET . EntityFramework . NUnit . DTO ;
@@ -51,17 +49,17 @@ public void TestEntityRepository()
5149 Password = "test"
5250 } ;
5351
54- entity = uow . EntityRepository < User > ( ) . Insert ( entity ) ;
52+ entity = uow . Repository < User > ( ) . Insert ( entity ) ;
5553 uow . SaveChanges ( ) ;
5654 Assert . AreNotEqual ( entity . Id , 0 ) ;
5755 Console . WriteLine ( entity . Id ) ;
5856 entity . Password = "test2" ;
59- uow . EntityRepository < User > ( ) . Update ( entity , entity . Id ) ;
57+ uow . Repository < User > ( ) . Update ( entity , entity . Id ) ;
6058 uow . SaveChanges ( ) ;
61- Assert . AreEqual ( entity . Password , uow . EntityRepository < User > ( ) . Entity ( entity . Id ) . Password ) ;
62- uow . EntityRepository < User > ( ) . Delete ( entity . Id ) ;
59+ Assert . AreEqual ( entity . Password , uow . Repository < User > ( ) . Entity ( entity . Id ) . Password ) ;
60+ uow . Repository < User > ( ) . Delete ( entity . Id ) ;
6361 uow . SaveChanges ( ) ;
64- Assert . IsNull ( uow . EntityRepository < User > ( ) . Entity ( entity . Id ) ) ;
62+ Assert . IsNull ( uow . Repository < User > ( ) . Entity ( entity . Id ) ) ;
6563 }
6664 }
6765
@@ -72,7 +70,7 @@ public void TestDTORepository()
7270
7371 using ( var uow = new EntityUnitOfWork < TestDbContext > ( ) )
7472 {
75- var users = uow . EntityRepository < User , UserDTO > ( ) . List ( ) ;
73+ var users = uow . Repository < User , UserDTO > ( ) . List ( ) ;
7674 stopwatch . Stop ( ) ;
7775 Console . WriteLine ( stopwatch . ElapsedMilliseconds ) ;
7876
@@ -85,20 +83,20 @@ public void TestDTORepository()
8583 Password = "test"
8684 } ;
8785
88- dto = uow . EntityRepository < User , UserDTO > ( ) . Insert ( dto ) ;
86+ dto = uow . Repository < User , UserDTO > ( ) . Insert ( dto ) ;
8987 uow . SaveChanges ( ) ;
9088 var login = dto . Login ;
91- dto = uow . EntityRepository < User , UserDTO > ( ) . DTO ( d => d . Login == login ) ;
89+ dto = uow . Repository < User , UserDTO > ( ) . DTO ( d => d . Login == login ) ;
9290 Assert . IsNotNull ( dto ) ;
9391 Assert . AreNotEqual ( dto . Id , 0 ) ;
9492 Console . WriteLine ( dto . Id ) ;
9593 dto . Password = "test2" ;
96- uow . EntityRepository < User , UserDTO > ( ) . Update ( dto , dto . Id ) ;
94+ uow . Repository < User , UserDTO > ( ) . Update ( dto , dto . Id ) ;
9795 uow . SaveChanges ( ) ;
98- Assert . AreEqual ( dto . Password , uow . EntityRepository < User , UserDTO > ( ) . DTO ( dto . Id ) . Password ) ;
99- uow . EntityRepository < User , UserDTO > ( ) . Delete ( dto . Id ) ;
96+ Assert . AreEqual ( dto . Password , uow . Repository < User , UserDTO > ( ) . DTO ( dto . Id ) . Password ) ;
97+ uow . Repository < User , UserDTO > ( ) . Delete ( dto . Id ) ;
10098 uow . SaveChanges ( ) ;
101- Assert . IsNull ( uow . EntityRepository < User , UserDTO > ( ) . DTO ( dto . Id ) ) ;
99+ Assert . IsNull ( uow . Repository < User , UserDTO > ( ) . DTO ( dto . Id ) ) ;
102100 }
103101 }
104102
@@ -178,13 +176,9 @@ public void TestReflection()
178176 {
179177 Console . WriteLine ( uow . UserRolesRegistered ) ;
180178
181- Assert . IsNotNull ( uow . Repository < User , UserDTO > ( ) , "uow.Users != null by reflection base" ) ;
182- Assert . IsNotNull ( uow . Repository < Role , RoleDTO > ( ) , "uow.Roles != null by reflection base" ) ;
183- Assert . IsNotNull ( uow . Repository < UserRole , UserRoleDTO > ( ) , "uow.UserRoles != null by reflection base" ) ;
184-
185- Assert . IsNotNull ( uow . EntityRepository < User , UserDTO > ( ) , "uow.Users != null by reflection" ) ;
186- Assert . IsNotNull ( uow . EntityRepository < Role , RoleDTO > ( ) , "uow.Roles != null by reflection" ) ;
187- Assert . IsNotNull ( uow . EntityRepository < UserRole , UserRoleDTO > ( ) , "uow.UserRoles != null by reflection" ) ;
179+ Assert . IsNotNull ( uow . Repository < User , UserDTO > ( ) , "uow.Users != null by reflection" ) ;
180+ Assert . IsNotNull ( uow . Repository < Role , RoleDTO > ( ) , "uow.Roles != null by reflection" ) ;
181+ Assert . IsNotNull ( uow . Repository < UserRole , UserRoleDTO > ( ) , "uow.UserRoles != null by reflection" ) ;
188182
189183 Assert . IsNotNull ( uow . Users , "uow.Users != null" ) ;
190184 Assert . IsNotNull ( uow . Roles , "uow.Roles != null" ) ;
0 commit comments