public IActionResult ListLegalis() { /*List<Kes_Bolt> kesboltok = KnifeStoreLogic.GetAllKes_Bolt().ToList(); * List<Kes> kesek = KnifeLogic.GetAllKes().ToList(); * var q1 = * (from x in kesboltok * join y in kesek on x.Raktar_Id equals y.Raktar_Id into g * from Kesek in g * where Kesek.Penge_Hossz <= 80 * select new Legalis { Termek= Kesek, Bolt=x});*/ return(View(NonCrudLogic.Legalis(KnifeStoreLogic.GetAllKes_Bolt().ToList(), KnifeLogic.GetAllKes().ToList()))); }
public void Legalis() { Mock <IRepository <Kes_Bolt> > MockoltKesBoltRepo = new Mock <IRepository <Kes_Bolt> >(MockBehavior.Loose); Mock <IRepository <Kes> > MockoltKesRepo = new Mock <IRepository <Kes> >(MockBehavior.Loose); List <Kes_Bolt> KesBoltLista = new List <Kes_Bolt>(); KesBoltLista.Add(new Kes_Bolt() { Raktar_Id = Guid.NewGuid().ToString(), Bolt_Nev = "Blade Hq", Cim = "564 West 700 South, Pleasant Grove, UT 84062, Egyesült Államok", Weboldal = "https://www.bladehq.com/" }); KesBoltLista.Add(new Kes_Bolt() { Raktar_Id = Guid.NewGuid().ToString(), Bolt_Nev = "Extrametál Kés (üzlethálózat)", Cim = "Extrametál,Magyarország", Weboldal = "https://extrametal.hu/" }); /*KESEK:-----------*/ List <Kes> KesLista = new List <Kes>(); /*ELSO BOLTBA-----------*/ KesLista.Add(new Kes() { Gyartasi_Cikkszam = Guid.NewGuid().ToString(), Gyarto = "Spyderco", Modell_nev = "Delica", Markolat = "FRN", Bevont_Penge = false, Penge_Hossz = 73, Acel = "VG-10", Ar = 35490, Raktar_Id = KesBoltLista[0].Raktar_Id }); KesLista.Add(new Kes() { Gyartasi_Cikkszam = Guid.NewGuid().ToString(), Gyarto = "Benchmade", Modell_nev = "Anthem 781", Markolat = "Titanium", Bevont_Penge = false, Penge_Hossz = 89, Acel = "CPM-S30V", Ar = 183690, Raktar_Id = KesBoltLista[0].Raktar_Id }); /*Masodik BOLTBA-----------*/ KesLista.Add(new Kes() { Gyartasi_Cikkszam = Guid.NewGuid().ToString(), Gyarto = "Spyderco", Modell_nev = "Delica", Markolat = "FRN", Bevont_Penge = false, Penge_Hossz = 73, Acel = "VG-10", Ar = 35490, Raktar_Id = KesBoltLista[1].Raktar_Id }); KesLista.Add(new Kes() { Gyartasi_Cikkszam = Guid.NewGuid().ToString(), Gyarto = "Benchmade", Modell_nev = "Anthem 781", Markolat = "Titanium", Bevont_Penge = false, Penge_Hossz = 89, Acel = "CPM-S30V", Ar = 183690, Raktar_Id = KesBoltLista[1].Raktar_Id }); List <Legalis> ElvartLegalisLista = new List <Legalis>(); ElvartLegalisLista.Add(new Statisztika.Legalis() { Bolt = KesBoltLista[0], Termek = KesLista[0] }); ElvartLegalisLista.Add(new Statisztika.Legalis() { Bolt = KesBoltLista[1], Termek = KesLista[2] }); /*---------*/ MockoltKesBoltRepo.Setup(x => x.Read()).Returns(KesBoltLista.AsQueryable()); MockoltKesRepo.Setup(x => x.Read()).Returns(KesLista.AsQueryable()); NemCRUDLogic nemCRUDLogic = new NemCRUDLogic(MockoltKesBoltRepo.Object, MockoltKesRepo.Object); var kimenet = nemCRUDLogic.Legalis(KesBoltLista, KesLista); Assert.That(kimenet, Is.EquivalentTo(ElvartLegalisLista)); Assert.That(kimenet.Count, Is.EqualTo(ElvartLegalisLista.Count)); }