예제 #1
0
        public async Task GetEntitiesAsync()
        {
            var mEntity1 = await DatabaseInitializeHelper.CreateMEntityWithSomeNEntites();
            var mEntity2 = await DatabaseInitializeHelper.CreateMEntityWithSomeNEntites();
            var mEntity3 = await DatabaseInitializeHelper.CreateMEntityWithSomeNEntites();

            using (IDataAccessor dataAccessor = new DataAccessor(_dbContextFactory))
            {
                var mEntities = await dataAccessor.GetEntitiesAsync<MEntity>(mE => mE.Id.Equals(mEntity1.Id) || mE.Id.Equals(mEntity2.Id),
                    mE => mE.NEntities);
                Assert.AreEqual(2, mEntities.Count);
                Assert.IsTrue(mEntities.Any(mE => mE.Id.Equals(mEntity1.Id)));
                Assert.IsTrue(mEntities.Any(mE => mE.Id.Equals(mEntity2.Id)));
            }

        }