Exemple #1
0
        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));
        }
Exemple #2
0
 public IActionResult ListAllWitchers()
 {
     return(View(WitcherLogic.GetAll()));
 }
Exemple #3
0
 public IEnumerable <Witcher> GetAllWitcher()
 {
     return(logic.GetAll());
 }