public void GetAllWitchers() { Mock <IRepository <Witcher> > mock = new Mock <IRepository <Witcher> >(MockBehavior.Loose); List <Witcher> TList = new List <Witcher>() { new Witcher() { Name = "Geralt of Testia", Age = 40, AvaragePay = 440, School = "School of the Wolf" }, new Witcher() { Name = "Fred", Age = 50, AvaragePay = 350, School = "School of the Cat" }, new Witcher() { Name = "Bob", Age = 35, AvaragePay = 4000, School = "School of the Griffin" } }; mock.Setup(x => x.GetAll()).Returns(TList.AsQueryable); //--- WitcherLogic wl = new WitcherLogic(mock.Object); var output = wl.GetAll(); //--- List <Witcher> WList = new List <Witcher>() { TList[0], TList[1], TList[2] }; Assert.That(output, Is.EquivalentTo(WList)); Assert.That(output.Count, Is.EqualTo(WList.Count)); }
public IActionResult ListAllWitchers() { return(View(WitcherLogic.GetAll())); }
public IEnumerable <Witcher> GetAllWitcher() { return(logic.GetAll()); }