Пример #1
0
        public void FilterById_FromCurrentFilter()
        {
            TestingContext context = new TestingContext();
            Role           role    = ObjectFactory.CreateRole();

            context.Set <Role>().Add(role);
            context.SaveChanges();

            IUnitOfWork unitOfWork = new UnitOfWork(context);

            datalist = new MvcDatalist <Role, RoleView>(unitOfWork);

            datalist.Filter.Id = role.Id.ToString();

            RoleView expected = unitOfWork.Select <Role>().To <RoleView>().Single();
            RoleView actual   = datalist.FilterById(null).Single();

            Assert.Equal(expected.CreationDate, actual.CreationDate);
            Assert.Equal(expected.Title, actual.Title);
            Assert.Equal(expected.Id, actual.Id);
        }
Пример #2
0
        public void FilterById_NotInteger_ReturnsEmpty()
        {
            datalist.Filter.Id = "A";

            Assert.Empty(datalist.FilterById(null));
        }