public void Test_RepositorReadOnlyAsync() { //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 IRepositoryReadOnlyAsync <Assembler> RoRepository = new MyRepository <Assembler, MyContext>(this.uow, "Assemblers", new KeyValuePair <string, Type>("id", typeof(int))); //Test Find method var asb = RoRepository.FindAsync(f => f.name == assembler).Result; Assert.IsNotNull(asb); Assert.AreEqual(true, asb.id == ind + 1 && asb.name == assembler); //Test FindAll var asbs = RoRepository.FindAllAsync(f => 1 == 1).Result; Assert.IsNotNull(asbs); Assert.AreEqual(10, asbs.Count); //Delete TestClearDb(); }
public void Test_RepositorReadOnlyPaginationAsync() { //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 IRepositoryReadOnlyPaginationExtendedAsync <Assembler> RoRepository = new MyRepository <Assembler, MyContext>(this.uow, "Assemblers", new KeyValuePair <string, Type>("id", typeof(int))); //Test FindAll method var asb = RoRepository.FindAllAsync(1, 5, f => f.name, false, f => 1 == 1).Result; Assert.IsNotNull(asb); Assert.AreEqual(10, asb.TotalRegisters); Assert.AreEqual(5, asb.Collection.Count); //Delete TestClearDb(); }