예제 #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 DatalistProxy <Role, RoleView>(unitOfWork);

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

            RoleView expected = unitOfWork.Select <Role>().To <RoleView>().Single();
            RoleView actual   = datalist.BaseFilterById(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.CurrentFilter.Id = "A";

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