Esempio n. 1
0
 protected CrudRepositoryTests <CNCLibContext, User, int, IUserRepository> CreateTestContext()
 {
     return(new CrudRepositoryTests <CNCLibContext, User, int, IUserRepository>()
     {
         CreateTestDbContext = () =>
         {
             var context = TestFixture.CreateDbContext();
             var uow = new UnitOfWork <CNCLibContext>(context);
             var rep = new UserRepository(context);
             return new CrudTestDbContext <CNCLibContext, User, int, IUserRepository>(context, uow, rep);
         },
         GetEntityKey = (entity) => entity.UserId,
         SetEntityKey = (entity, id) => entity.UserId = id,
         CompareEntity = (entity1, entity2) => CompareProperties.AreObjectsPropertiesEqual(entity1, entity2, new[] { @"UserId" })
     });
 }
Esempio n. 2
0
 protected CRUDRepositoryTests <CNCLibContext, Machine, int, IMachineRepository> CreateTestContext()
 {
     return(new CRUDRepositoryTests <CNCLibContext, Machine, int, IMachineRepository>()
     {
         CreateTestDbContext = () =>
         {
             var context = TestFixture.CreateDbContext();
             var uow = new UnitOfWork <CNCLibContext>(context);
             var rep = new MachineRepository(context, UserContext);
             return new CRUDTestDbContext <CNCLibContext, Machine, int, IMachineRepository>(context, uow, rep);
         },
         GetEntityKey = (entity) => entity.MachineId,
         SetEntityKey = (entity, key) => entity.MachineId = key,
         CompareEntity = (entity1, entity2) => CompareProperties.AreObjectsPropertiesEqual(entity1, entity2, new[] { @"MachineId", @"MachineCommandId", @"MachineInitCommandId" })
     });
 }
Esempio n. 3
0
 protected CrudRepositoryTests <CNCLibContext, Configuration, int, IConfigurationRepository> CreateTestContext()
 {
     return(new CrudRepositoryTests <CNCLibContext, Configuration, int, IConfigurationRepository>()
     {
         CreateTestDbContext = () =>
         {
             var context = TestFixture.CreateDbContext();
             var uow = new UnitOfWork <CNCLibContext>(context);
             var rep = new ConfigurationRepository(context);
             return new CrudTestDbContext <CNCLibContext, Configuration, int, IConfigurationRepository>(context, uow, rep);
         },
         GetEntityKey = (entity) => entity.ConfigurationId,
         SetEntityKey = (entity, key) => entity.ConfigurationId = key,
         CompareEntity = (entity1, entity2) => CompareProperties.AreObjectsPropertiesEqual(entity1, entity2, new[] { @"ConfigurationId", })
     });
 }
Esempio n. 4
0
 protected CrudRepositoryTests <CNCLibContext, Item, int, IItemRepository> CreateTestContext()
 {
     return(new CrudRepositoryTests <CNCLibContext, Item, int, IItemRepository>()
     {
         CreateTestDbContext = () =>
         {
             var context = TestFixture.CreateDbContext();
             var uow = new UnitOfWork <CNCLibContext>(context);
             var rep = new ItemRepository(context);
             return new CrudTestDbContext <CNCLibContext, Item, int, IItemRepository>(context, uow, rep);
         },
         GetEntityKey = (entity) => entity.ItemId,
         SetEntityKey = (entity, key) =>
         {
             entity.ItemId = key;
             foreach (var itemProp in entity.ItemProperties)
             {
                 itemProp.ItemId = key;
             }
         },
         CompareEntity = (entity1, entity2) => CompareProperties.AreObjectsPropertiesEqual(entity1, entity2, new[] { @"ItemId", @"User" })
     });
 }
 protected CRUDRepositoryTests <CNCLibContext, Configuration, ConfigurationPrimary, IConfigurationRepository> CreateTestContext()
 {
     return(new CRUDRepositoryTests <CNCLibContext, Configuration, ConfigurationPrimary, IConfigurationRepository>()
     {
         CreateTestDbContext = () =>
         {
             var context = TestFixture.CreateDbContext();
             var uow = new UnitOfWork <CNCLibContext>(context);
             var rep = new ConfigurationRepository(context, UserContext);
             return new CRUDTestDbContext <CNCLibContext, Configuration, ConfigurationPrimary, IConfigurationRepository>(context, uow, rep);
         },
         GetEntityKey = (entity) => new ConfigurationPrimary()
         {
             Group = entity.Group, Name = entity.Name
         },
         SetEntityKey = (entity, key) =>
         {
             entity.Group = key.Group;
             entity.Name = key.Name;
         },
         CompareEntity = (entity1, entity2) => CompareProperties.AreObjectsPropertiesEqual(entity1, entity2, new string[0])
     });
 }