Exemplo n.º 1
0
        public Successful()
        {
            var db = new EFInMemoryDatabase();

            _context = db.CreateDataContext <EFDataContext>();
            var repository = new EFBookRepository(_context);
            var unitOfWork = new EFUnitOfWork(_context);

            _sut = new BookAppService(repository, unitOfWork);
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, EFBookRepository context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMvc();

            DbInitializer.Initialize(context, env);
        }
Exemplo n.º 3
0
        public FailedWhenDeterminateReturnDateWasExpired()
        {
            var db = new EFInMemoryDatabase();

            _context = db.CreateDataContext <EFDataContext>();
            var repository       = new EFEntrustRepository(_context);
            var unitOfWork       = new EFUnitOfWork(_context);
            var bookRepository   = new EFBookRepository(_context);
            var memberRepository = new EFMemberRepository(_context);

            _sut = new EntrustAppService(repository, unitOfWork, bookRepository, memberRepository);
        }
Exemplo n.º 4
0
        public Successful()
        {
            var db = new EFInMemoryDatabase();

            _context     = db.CreateDataContext <EFDataContext>();
            _readContext = db.CreateDataContext <EFDataContext>();
            var repository       = new EFEntrustRepository(_context);
            var unitOfWork       = new EFUnitOfWork(_context);
            var bookRepository   = new EFBookRepository(_context);
            var memberRepository = new EFMemberRepository(_context);

            _sut = new EntrustAppService(repository, unitOfWork, bookRepository, memberRepository);
        }
        public FailedWhenMemberAgeIsNotInRangeException()
        {
            var db = new EFInMemoryDatabase();

            _context     = db.CreateDataContext <EFDataContext>();
            _readContext = db.CreateDataContext <EFDataContext>();
            var repository       = new EFEntrustRepository(_context);
            var unitOfWork       = new EFUnitOfWork(_context);
            var bookRepository   = new EFBookRepository(_context);
            var memberRepository = new EFMemberRepository(_context);

            _sut = new EntrustAppService(repository, unitOfWork, bookRepository, memberRepository);
        }
Exemplo n.º 6
0
        public EntrustServiceTests()
        {
            var db = new EFInMemoryDatabase();

            _context     = db.CreateDataContext <EFDataContext>();
            _readContext = db.CreateDataContext <EFDataContext>();
            var repository       = new EFEntrustRepository(_context);
            var unitOfWork       = new EFUnitOfWork(_context);
            var bookRepository   = new EFBookRepository(_context);
            var memberRepository = new EFMemberRepository(_context);

            _sut      = new EntrustAppService(repository, unitOfWork, bookRepository, memberRepository);
            _category = BookCategoryFactory.GenerateBookCategory("dummy-title");
        }
Exemplo n.º 7
0
        public void CanSort(int value, string valuestr, string first, string second, int kol)
        {
            var t = new EFDbContext();
            //private IKernel kernel;
            var r          = new EFBookRepository();
            var controller = new BookController(r)
            {
                pageSize = value
            };

            // Action
            var result = ((BooksListViewModel)controller.List(valuestr, 1).Model).Books.ToList();

            // Assert
            result.Count.Should().Be(kol);
            result[0].Name.Should().Be(first);
            result[1].Name.Should().Be(second);
        }
Exemplo n.º 8
0
        public void Delete_Book()
        {
            var t = new EFDbContext();
            var r = new EFBookRepository();
            //var b = new Book;
            var count = t.Books.Count();
            var books = t.Books.ToList();
            var id    = books.LastOrDefault();

            if (id != null)
            {
                r.DeleteBook(id.BookId);
            }

            t.SaveChanges();

            var result = t.Books.Count();

            result.Should().Be(count - 1);
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            IBookRepository repo = new EFBookRepository();

            Console.WriteLine(repo.Books.ToString());
        }