Пример #1
0
        public void TestInitializer()
        {
            var uow = Substitute.For <IUnitOfWork2>();

            _bookOfficesDbSet = Substitute.For <IDbSet <BookOffice> >();
            uow.GetDbSet <BookOffice>().Returns(_bookOfficesDbSet);

            _bookLogsDbSet = Substitute.For <IDbSet <BookLog> >();
            uow.GetDbSet <BookLog>().Returns(_bookLogsDbSet);

            _booksDbSet = Substitute.For <IDbSet <Book> >();
            uow.GetDbSet <Book>().Returns(_booksDbSet);

            _officesDbSet = Substitute.For <IDbSet <Office> >();
            uow.GetDbSet <Office>().Returns(_officesDbSet);

            _userDbSet = Substitute.For <IDbSet <ApplicationUser> >();
            uow.GetDbSet <ApplicationUser>().Returns(_userDbSet);

            _validationService    = Substitute.For <IBookMobileServiceValidator>();
            _bookInfoService      = Substitute.For <IBookInfoService>();
            _bookServiceValidator = new BookServiceValidator();
            var bookNotificationService = Substitute.For <IBooksNotificationService>();

            _bookService = new BookService(uow, _bookInfoService, _bookServiceValidator, bookNotificationService, _validationService);
        }
Пример #2
0
        public void TestInitializer()
        {
            var uow = Substitute.For <IUnitOfWork2>();

            _bookOfficesDbSet = Substitute.For <DbSet <BookOffice>, IQueryable <BookOffice>, IDbAsyncEnumerable <BookOffice> >();
            uow.GetDbSet <BookOffice>().Returns(_bookOfficesDbSet);

            _bookLogsDbSet = Substitute.For <DbSet <BookLog>, IQueryable <BookLog>, IDbAsyncEnumerable <BookLog> >();
            uow.GetDbSet <BookLog>().Returns(_bookLogsDbSet);

            _booksDbSet = Substitute.For <DbSet <Book>, IQueryable <Book>, IDbAsyncEnumerable <Book> >();
            uow.GetDbSet <Book>().Returns(_booksDbSet);

            _officesDbSet = Substitute.For <DbSet <Office>, IQueryable <Office>, IDbAsyncEnumerable <Office> >();
            uow.GetDbSet <Office>().Returns(_officesDbSet);

            _userDbSet = Substitute.For <DbSet <ApplicationUser>, IQueryable <ApplicationUser>, IDbAsyncEnumerable <ApplicationUser> >();
            uow.GetDbSet <ApplicationUser>().Returns(_userDbSet);

            _appSettings          = Substitute.For <IApplicationSettings>();
            _validationService    = Substitute.For <IBookMobileServiceValidator>();
            _bookInfoService      = Substitute.For <IBookInfoService>();
            _roleService          = Substitute.For <IRoleService>();
            _userService          = Substitute.For <IUserService>();
            _mailingService       = Substitute.For <IMailingService>();
            _mailTemplate         = Substitute.For <IMailTemplate>();
            _organizationService  = Substitute.For <IOrganizationService>();
            _bookServiceValidator = new BookServiceValidator();
            var asyncRunner = Substitute.For <IAsyncRunner>();

            _bookService = new BookService(uow, _appSettings, _roleService, _userService, _mailingService, _mailTemplate, _organizationService, _bookInfoService, _bookServiceValidator,
                                           _validationService, asyncRunner);
        }