public ActionResult Insert()
        {
            ViewBag.CategoryID = new SelectList(cs.GetAll(), "ID", "Name");
            //TODO: Sadece Kategori seçtiriyorum bu kategorinin alt kategorisi varsa ayrıca sormak gerekebilir. Ya da alt kategorisi varsa viewbag ile mesaj söylemek gerekebilir. O zaman alt kategorisi olan bir ana kategori seçemiyor olur.
            ViewBag.AuthorID    = new SelectList(aus.GetAll(), "ID", "AuthorLabel");
            ViewBag.PublisherID = new SelectList(ps.GetAll(), "ID", "CompanyName");

            return(View());
        }
        public IActionResult Index()
        {
            var publishers = _publisherService.GetAll();
            var model      = _mapper.Map <List <PublisherIndexViewModel> >(publishers);

            return(View(model));
        }
        public void GetAll_ReturnsListOfPublishers()
        {
            var publishersList = fixture.Create <IEnumerable <Publisher> >();

            mockPublisherRepo.Setup(x => x.GetAll()).Returns(publishersList);
            mockPublisherService.Setup(x => x.GetAll()).Returns(publishersList);

            var result = publisherService.GetAll();

            mockPublisherRepo.Verify(x => x.GetAll(), Times.Once());
            //mockPublisherService.Verify(x => x.GetAll(), Times.Once());

            Assert.IsNotNull(result);
            Assert.IsInstanceOf <IEnumerable <Publisher> >(result);
            Assert.IsNotEmpty(result);
        }
        public async Task GetAll_Test()
        {
            // arrange
            var fakeUowProvider  = A.Fake <IUnitOfWorkProvider>();
            var fakeRepoProvider = A.Fake <IPublisherRepositoryProvider>();
            var fakeRepo         = A.Fake <IPublisherRepository>();
            var fakeUow          = A.Fake <IUnitOfWork>();

            A.CallTo(() => fakeUowProvider.Get()).Returns(fakeUow);
            A.CallTo(() => fakeRepoProvider.Get(fakeUow)).Returns(fakeRepo);
            PublisherService service    = new PublisherService(fakeUowProvider, fakeRepoProvider);
            List <Publisher> publishers = new List <Publisher>
            {
                new Publisher("pub1"),
                new Publisher("pub2")
            };

            A.CallTo(() => fakeRepo.ReadAll()).Returns(publishers);

            // act
            var result = await service.GetAll();

            // assert
            Assert.IsTrue(result.ToList().Count == 2);
            Assert.IsTrue(result.ToList()[0].Name.Equals("pub1"));
            Assert.IsTrue(result.ToList()[1].Name.Equals("pub2"));
        }
Beispiel #5
0
        public void GetAllPublishers_AllPublishersReturned()
        {
            _uow.Setup(uow => uow.Publishers.GetAll()).Returns(_fakePublishers);

            var resultPublishers = _sut.GetAll();

            Assert.Equal(resultPublishers.Count(), _fakePublishers.Count);
        }
        public IEnumerable <PLPublisher> GetAll()
        {
            IEnumerable <BLLPublisher> resultBLL = _curPublWorkerService.GetAll();
            var resultPL = resultBLL.Select(item => new PLPublisher {
                Id = item.Id, PublisherName = item.PublisherName, LicenseNumber = item.LicenseNumber
            });

            return(resultPL);
        }
        private async Task <List <SelectListItem> > GetPublishersSelectList()
        {
            var publishers = (await m_publisherService.GetAll())
                             .Select(p => new SelectListItem
            {
                Text  = p.Name,
                Value = p.Id.ToString()
            }).ToList();

            return(publishers);
        }
Beispiel #8
0
        private List <SelectListItem> GetPublisherSelectListItems()
        {
            var result     = new List <SelectListItem>();
            var publishers = _publisherService.GetAll();

            foreach (var publisher in publishers)
            {
                result.Add(new SelectListItem(publisher.Name, publisher.PublisherId.ToString()));
            }
            return(result);
        }
Beispiel #9
0
        public async Task GetAllTest()
        {
            var result = await publisherService.GetAll();

            Assert.Collection(result, publisher =>
            {
                Assert.Equal(publishers[0].name, publisher.name);
            },
                              publisher =>
            {
                Assert.Equal(publishers[1].name, publisher.name);
            });
        }
 public DataTable GetAllPublisher()
 {
     return(PublisherService.GetAll());
 }
Beispiel #11
0
 // GET: Publisher
 public async Task <IActionResult> Index()
 {
     return(View(await _publisherService.GetAll()));
 }
Beispiel #12
0
        public IActionResult Get()
        {
            var publishers = _publisherService.GetAll();

            return(Ok(publishers));
        }
        public async Task <IActionResult> Index()
        {
            var model = await m_publisherService.GetAll();

            return(View(model));
        }
Beispiel #14
0
 public IEnumerable <Publisher> Get()
 {
     return(service.GetAll());
 }