Пример #1
0
        public void GetOneList11()
        {
            var mock = new Mock<IRepository<Person>>();
            mock.Setup(a => a.Read(list11[0].ID)).Returns(list11[0]);
            var controller = new PersonController(mock.Object);

            var result = controller.PersonData(list11[0].ID) as ViewResult;

            Assert.IsNotNull(result.Model);
            Assert.AreEqual(list11m[0].ToString(), result.Model.ToString());
        }
Пример #2
0
        public void GetAllList11()
        {
            var mock = new Mock<IRepository<Person>>();
            mock.Setup(a => a.ReadAll()).Returns(list11);
            var controller = new PersonController(mock.Object);

            var result = controller.Index() as ViewResult;

            Assert.IsNotNull(result.Model);
            CollectionAssert.AreEqual($"" + list11m, $"" + (IEnumerable<PersonViewModel>)result.Model);
        }
Пример #3
0
        public void GetAllList12()
        {
            var mock = new Mock<IRepository<Person>>();
            mock.Setup(a => a.ReadAll()).Returns(list12);
            var controller = new PersonController(mock.Object);

            var result = controller.Index() as ViewResult;

            Assert.IsNotNull(result.Model);
            CollectionAssert.AreEqual(list12m.ToString(), result.Model.ToString());
        }
        public void PersonIndexList0()
        {
            var mock = new Mock<IRepository<Person>>();
            mock.Setup(a => a.ReadAll()).Returns(list0);
            var controller = new PersonController(mock.Object);

            var result = controller.Index() as ViewResult;

            Assert.IsNotNull(result.Model);
            Assert.AreEqual(list0, result.Model);
        }