public void ReIntializeTest()
        {
            _dbEntities        = new Mock <WebApiDbEntities1>().Object;
            _productRepository = SetUpProductRepository();
            var unitOfWork = new Mock <IUnitOfWork>();

            unitOfWork.SetupGet(s => s.ProductRepository).Returns(_productRepository);
            _unitOfWork     = unitOfWork.Object;
            _productService = new ProductServices(_unitOfWork);
        }
        public void Setup()
        {
            _products          = SetUpProducts();
            _tokens            = SetUpTokens();
            _dbEntities        = new Mock <WebApiDbEntities1>().Object;
            _tokenRepository   = SetUpTokenRepository();
            _productRepository = SetUpProductRepository();
            var unitOfWork = new Mock <IUnitOfWork>();

            unitOfWork.SetupGet(s => s.ProductRepository).Returns(_productRepository);
            unitOfWork.SetupGet(s => s.TokenRepository).Returns(_tokenRepository);
            _unitOfWork     = unitOfWork.Object;
            _productService = new ProductServices(_unitOfWork);
            _tokenService   = new TokenServices(_unitOfWork);
            _client         = new HttpClient {
                BaseAddress = new Uri(ServiceBaseURL)
            };
            var tokenEntity = _tokenService.GenerateToken(1);

            _token = tokenEntity.AuthToken;
            _client.DefaultRequestHeaders.Add("Token", _token);
        }
 /// <summary>
 /// Public Constructor,initializes privately declared local variables.
 /// </summary>
 /// <param name="context"></param>
 public GenericRepository(WebApiDbEntities1 context)
 {
     this.Context = context;
     this.DbSet   = context.Set <TEntity>();
 }
Example #4
0
 public UnitOfWork()
 {
     _context = new WebApiDbEntities1();
 }