예제 #1
0
        public void Test_RepositorReadOnlyExtendedAsync()
        {
            //Insert
            TestInsert10Assember();

            //Select a Randon index between 0 and 9 and get name selected
            int    ind       = new Random().Next(0, 9);
            string assembler = assmblers[ind];

            //Create Repository
            IRepositoryReadOnlyExtendedAsync <Assembler> RoRepository = new MyRepository <Assembler, MyContext>(this.uow, "Assemblers", new KeyValuePair <string, Type>("id", typeof(int)));

            //Test Count method
            Assert.AreEqual(10, RoRepository.CountAsync(f => 1 == 1).Result);

            //Test FindAll
            Assert.IsTrue(RoRepository.ExistsAsync(f => f.name == assembler).Result);

            //Delete
            TestClearDb();
        }