Exemple #1
0
        public ClasstourRepoTest()
        {
            var dbOptions = DbInMemory.getDbInMemoryOptions(dbName);

            db            = new TCSContext(dbOptions);
            classTourRepo = new ClassTourRepo(dbOptions);
        }
        public SessionsRepoTest()
        {
            var dbOptions = DbInMemory.getDbInMemoryOptions(dbName);

            db          = new TCSContext(dbOptions);
            sessionRepo = new SessionRepo(dbOptions);
        }
Exemple #3
0
        public UnitOfWorkSessionTest()
        {
            var dbInMemory   = DbInMemory.getDbInMemoryOptions(dbName);
            var personRepo   = new PersonRepo(dbInMemory);
            var sessionRepo  = new SessionRepo(dbInMemory);
            var reasonRepo   = new ReasonRepo(dbInMemory);
            var classRepo    = new ClassRepo(dbInMemory);
            var semesterRepo = new SemesterRepo(dbInMemory);

            db          = new TCSContext(dbInMemory);
            unitSession = new UnitOfWorkSession(personRepo, reasonRepo, sessionRepo, classRepo, semesterRepo);
        }
Exemple #4
0
        public UserRepoTest()
        {
            var dbOptions = DbInMemory.getDbInMemoryOptions(dbName);

            db       = new TCSContext(dbOptions);
            userRepo = new UserRepo(dbOptions);
            fixture  = new Fixture()
                       .Customize(new AutoMoqCustomization());

            // Sets all users created by autofixture to not have properties set
            fixture.Customize <User> ((ob) => ob.Without(x => x.Id).Without(x => x.PasswordHash).Without(x => x.PasswordSalt));
        }
        public UnitOfWorkPersonTest()
        {
            var dbInMemory     = DbInMemory.getDbInMemoryOptions(dbName);
            var personRepo     = new PersonRepo(dbInMemory);
            var classRepo      = new ClassRepo(dbInMemory);
            var scheduleRepo   = new ScheduleRepo(dbInMemory);
            var semesterRepo   = new SemesterRepo(dbInMemory);
            var departmentRepo = new DepartmentRepo(dbInMemory);

            db = new TCSContext(dbInMemory);
            mockBannerService = new Mock <IBannerService>();

            unitPerson = new UnitOfWorkPerson(personRepo, scheduleRepo, classRepo, semesterRepo, departmentRepo, mockBannerService.Object);
        }
        public SessionsControllerTest()
        {
            var dbOptions = DbInMemory.getDbInMemoryOptions(dbName);

            db          = new TCSContext(dbOptions);
            sessionRepo = new SessionRepo(dbOptions);
            var personRepo        = new PersonRepo(dbOptions);
            var semesterRepo      = new SemesterRepo(dbOptions);
            var sessionClassRepo  = new SessionClassRepo(dbOptions);
            var sessionReasonRepo = new SessionReasonRepo(dbOptions);
            var mapper            = Helpers.Utils.GetProjectMapper();

            sessionController = new SessionsController(sessionRepo, semesterRepo, personRepo, sessionReasonRepo, sessionClassRepo, mapper);
        }
Exemple #7
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, TCSContext db, IUserRepo repo)
        {
            DbInitializer.InitializeData(db, repo, Environment);

            // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
            app.UseHsts();

            app.UseErrorWrapping();

            app.UseCors(AllowAnywhere);

            app.UseAuthentication();

            app.UseMvc();
        }
Exemple #8
0
        public SessionsControllerTest()
        {
            var dbOptions = DbInMemory.getDbInMemoryOptions(dbName);

            db          = new TCSContext(dbOptions);
            sessionRepo = new SessionRepo(dbOptions);
            var personRepo        = new PersonRepo(dbOptions);
            var semesterRepo      = new SemesterRepo(dbOptions);
            var sessionClassRepo  = new SessionClassRepo(dbOptions);
            var sessionReasonRepo = new SessionReasonRepo(dbOptions);
            var reasonRepo        = new ReasonRepo(dbOptions);
            var classRepo         = new ClassRepo(dbOptions);

            csvParser = new CSVSessionUploadParser();
            var mapper      = Utils.GetProjectMapper();
            var unitSession = new UnitOfWorkSession(personRepo, reasonRepo, sessionRepo, classRepo, semesterRepo);

            sessionController = new SessionsController(sessionRepo, semesterRepo, personRepo, sessionReasonRepo, sessionClassRepo, mapper, csvParser, unitSession);
        }
Exemple #9
0
        public UserRepoTest()
        {
            AppSettings appSettings = new AppSettings()
            {
                Secret = secret
            };

            mockAppSettings = new Mock <IOptions <AppSettings> >();
            mockAppSettings.Setup(ap => ap.Value).Returns(appSettings);
            var dbOptions = DbInMemory.getDbInMemoryOptions(dbName);

            db       = new TCSContext(dbOptions);
            userRepo = new UserRepo(dbOptions, mockAppSettings.Object);
            fixture  = new Fixture()
                       .Customize(new AutoMoqCustomization());

            // Sets all users created by autofixture to not have properties set
            fixture.Customize <User>((ob) => ob.Without(x => x.Id).Without(x => x.PasswordHash).Without(x => x.PasswordSalt));
        }
Exemple #10
0
        /// <summary>Configure</summary>
        /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, TCSContext db, IUserRepo repo)
        {
            DbInitializer.InitializeData(db, repo, Environment);

            app.UseSwagger(c => {
                c.RouteTemplate = "api/swagger/{documentName}/swagger.json";
            });
            app.UseSwaggerUI(c => {
                c.SwaggerEndpoint("../swagger/v1/swagger.json", "TCS API V1");
                c.RoutePrefix = "api/swagger";
            });

            // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
            app.UseHsts();

            app.UseErrorWrapping();

            app.UseCors(AllowAnywhere);

            app.UseAuthentication();

            app.UseMvc();
        }
 public EmpresaController(TCSContext context)
 {
     _context = context;
 }
Exemple #12
0
 protected BaseRepo(DbContextOptions options)
 {
     _db   = new TCSContext(options);
     table = _db.Set <T>();
 }
Exemple #13
0
 protected BaseRepo(TCSContext context)
 {
     _db   = context;
     table = _db.Set <T>();
 }
Exemple #14
0
 protected BaseRepo()
 {
     _db   = new TCSContext();
     table = _db.Set <T>();
 }
 public FornecedorController(TCSContext context)
 {
     _context = context;
 }