public void ChceckTypeListInAllPersonIfPeselNullMoq()
        {
            var ListPerson = new List <Person>();

            ListPerson.Add(new Person {
                imie = "Kasia", nazwisko = "Kowalska"
            });
            Mock <IPersonSharingContext> context = new Mock <IPersonSharingContext>();

            context.Setup(x => x.PersonOfPeselNull()).Returns(ListPerson.AsQueryable());
            var controller = new PersonController(context.Object);

            var result = controller.DisplayByPeselNull() as ViewResult;

            Assert.AreEqual(typeof(List <Person>), result.Model.GetType());
        }
        public void TestDisplayPersonByPeselNullMoq()
        {
            var ListPerson = new List <Person>();

            ListPerson.Add(new Person {
                imie = "Kasia", nazwisko = "Kowalska"
            });
            Mock <IPersonSharingContext> context = new Mock <IPersonSharingContext>();

            context.Setup(x => x.PersonOfPeselNull()).Returns(ListPerson.AsQueryable());
            var controller = new PersonController(context.Object);

            var result       = controller.DisplayByPeselNull() as ViewResult;
            var modelPersons = (IEnumerable <Person>)result.Model;

            Assert.AreEqual(1, modelPersons.Count());
        }
        public void ChceckTypeListInAllPersonIfPeselNull()
        {
            var context = new FakePersonSharingContext();

            context.Persons = new[] {
                new Person {
                    personId = 1, imie = "Kasia", nazwisko = "Kowalska", pesel = "56457867", adresId = 1
                },
                new Person {
                    personId = 2, imie = "Basia", nazwisko = "Kowalska", pesel = null, adresId = 2
                },
                new Person {
                    personId = 3, imie = "Masia", nazwisko = "Kowalska", pesel = null, adresId = 3
                }
            }.AsQueryable();
            var controller = new PersonController(context);
            var result     = controller.DisplayByPeselNull() as ViewResult;

            Assert.AreEqual(typeof(List <Person>), result.Model.GetType());
        }
        public void TestDisplayPersonByPeselNull()
        {
            var context = new FakePersonSharingContext();

            context.Persons = new[] {
                new Person {
                    personId = 1, imie = "Kasia", nazwisko = "Kowalska", pesel = "675678787", adresId = 1
                },
                new Person {
                    personId = 2, imie = "Basia", nazwisko = "Kowalska", pesel = null, adresId = 2
                },
                new Person {
                    personId = 3, imie = "Masia", nazwisko = "Kowalska", pesel = null, adresId = 3
                }
            }.AsQueryable();
            var controller   = new PersonController(context);
            var result       = controller.DisplayByPeselNull() as ViewResult;
            var modelPersons = (IEnumerable <Person>)result.Model;

            Assert.AreEqual(2, modelPersons.Count());
        }