Inheritance: ILookupCache
Ejemplo n.º 1
0
 public WorkerSigninController(IWorkerSigninService workerSigninService, 
     IWorkerService workerService,
     LookupCache lc)
 {
     this._serv = workerSigninService;
     this._wServ = workerService;
     this.lcache = lc;
 }
 public ActivitySigninController(IActivitySigninService serv, 
     IWorkerService wServ,
     LookupCache lc)
 {
     this.serv = serv;
     this.wServ = wServ;
     this.lcache = lc;
 }
Ejemplo n.º 3
0
 public ActivityService(IActivityRepository repo,
                        IActivitySigninService asServ,
                        LookupCache lc,
                        IUnitOfWork uow,
                        IMapper map) : base(repo, uow)
 {
     this.logPrefix = "Activity";
     this.lcache    = lc;
     this.map       = map;
     this.asServ    = asServ;
 }
Ejemplo n.º 4
0
 public void TestInitialize()
 {
     frb = new FluentRecordBase();
     // populates domain constants
     cache = new LookupCache(frb.ToFactory()); //Func<> to DB Factory
 }
Ejemplo n.º 5
0
 //
 //
 public EventController(IEventService eventService, IImageService imageServ, LookupCache lc)
 {
     this._serv = eventService;
     this.iServ = imageServ;
     this.lcache = lc;
 }
Ejemplo n.º 6
0
 public ActivityController(IActivityService aServ, LookupCache lc)
 {
     this.lcache = lc;
     this.serv = aServ;
 }
Ejemplo n.º 7
0
        public void TestInitialize()
        {
            // https://msdn.microsoft.com/en-us/data/dn314429.aspx
            // Testing with a mocking framework (EF6 onwards)
            _db = new Mock<IDatabaseFactory>();
            _ctxt = new Mock<MacheteContext>();
            //
            // lookupcache
            var list = new List<Lookup> {
                new Lookup { category = LCategory.memberstatus, key = LMemberStatus.Active },
                new Lookup { category = LCategory.memberstatus, key = LMemberStatus.Sanctioned },
                new Lookup { category = LCategory.memberstatus, key = LMemberStatus.Expelled },
                new Lookup { category = LCategory.memberstatus, key = LMemberStatus.Expired },
                new Lookup { category = LCategory.memberstatus, key = LMemberStatus.Inactive },
                new Lookup { category = LCategory.orderstatus, key = LOrderStatus.Active },
                new Lookup { category = LCategory.orderstatus, key = LOrderStatus.Pending },
                new Lookup { category = LCategory.orderstatus, key = LOrderStatus.Completed },
                new Lookup { category = LCategory.orderstatus, key = LOrderStatus.Cancelled },
                new Lookup { category = LCategory.orderstatus, key = LOrderStatus.Expired },
                new Lookup { category = LCategory.emailstatus, key = LEmailStatus.ReadyToSend },
                new Lookup { category = LCategory.emailstatus, key = LEmailStatus.Sent },
                new Lookup { category = LCategory.emailstatus, key = LEmailStatus.Sending },
                new Lookup { category = LCategory.emailstatus, key = LEmailStatus.Pending },
                new Lookup { category = LCategory.emailstatus, key = LEmailStatus.TransmitError }
            }.AsQueryable();
            _set = new Mock<DbSet<Lookup>>();
            _set.As<IQueryable<Lookup>>().Setup(m => m.Provider).Returns(list.Provider);
            _set.As<IQueryable<Lookup>>().Setup(m => m.Expression).Returns(list.Expression);
            _set.As<IQueryable<Lookup>>().Setup(m => m.ElementType).Returns(list.ElementType);
            _set.As<IQueryable<Lookup>>().Setup(m => m.GetEnumerator()).Returns(list.GetEnumerator());
            _set.Setup(r => r.AsNoTracking()).Returns(_set.Object);
            //
            // teacherCache
            var teachers = new List<ApplicationUser>
            {
                new ApplicationUser { UserName = "******" }
            }.AsQueryable();
            _users = new Mock<DbSet<ApplicationUser>>();
            _users.As<IQueryable<ApplicationUser>>().Setup(m => m.Provider).Returns(teachers.Provider);
            _users.As<IQueryable<ApplicationUser>>().Setup(m => m.Expression).Returns(teachers.Expression);
            _users.As<IQueryable<ApplicationUser>>().Setup(m => m.ElementType).Returns(teachers.ElementType);
            _users.As<IQueryable<ApplicationUser>>().Setup(m => m.GetEnumerator()).Returns(teachers.GetEnumerator());
            _users.Setup(r => r.AsNoTracking()).Returns(_users.Object);

            _ctxt.Setup(r => r.Lookups).Returns(_set.Object);
            _ctxt.Setup(r => r.Users).Returns(_users.Object);
            _db.Setup(r => r.Get()).Returns(_ctxt.Object);
            _serv = new LookupCache(_db.Object);
        }