Beispiel #1
0
        public void Remove(Guid id)
        {
            var entity = _context.Admin.Find(AdminQueries.GetAdminById(id));

            _context.Admin.Remove(entity);
            _context.SaveChanges();
        }
 public SiteControllerMethods(SiteQueries _dbQuery, AdminQueries _AdbQuery)
 {
     dbQuery       = _dbQuery;
     _dataLimiter  = new DataLimiter(_AdbQuery);
     authenticator = new SiteAuth(_AdbQuery, _dbQuery, _dataLimiter);
     validator     = new SiteCreationValidator(dbQuery);
 }
Beispiel #3
0
        public void Can_update_admin()
        {
            var admin = SecurityTestHelper.CreateAdmin();

            var firstName   = TestDataGenerator.GetRandomString();
            var lastName    = TestDataGenerator.GetRandomString();
            var status      = true;
            var language    = TestDataGenerator.GetRandomString();
            var description = TestDataGenerator.GetRandomString();

            admin.FirstName   = firstName;
            admin.LastName    = lastName;
            admin.IsActive    = status;
            admin.Language    = language;
            admin.Description = description;

            var adminData = Mapper.DynamicMap <EditAdminData>(admin);

            adminData.AllowedBrands     = admin.AllowedBrands.Select(b => b.Id).ToList();
            adminData.AssignedLicensees = admin.Licensees.Select(l => l.Id).ToList();
            adminData.Password          = TestDataGenerator.GetRandomString();

            AdminCommands.UpdateAdmin(adminData);

            admin = AdminQueries.GetAdminById(admin.Id);

            Assert.True(admin.FirstName == firstName);
            Assert.True(admin.LastName == lastName);
            Assert.True(admin.IsActive == status);
            Assert.True(admin.Language == language);
            Assert.True(admin.Description == description);
        }
 public AdminControllerMethods(AdminQueries _dbQuery, Mailer _mailer, IHttpContextAccessor httpContextAccesssor)
 {
     _httpContextAccesssor = httpContextAccesssor;
     _currentDomain        = _httpContextAccesssor.HttpContext.Request.Host.Value;
     dbQuery       = _dbQuery;
     mailer        = _mailer;
     authenticator = new Auth(_dbQuery);
     validator     = new RegistrationValidator(_dbQuery);
     _tGen         = new TokenGenerator();
 }
Beispiel #5
0
        public void Can_activate()
        {
            // *** Arrange ***
            var admin = SecurityTestHelper.CreateAdmin();

            // *** Act ***
            AdminCommands.Activate(new ActivateUserData(admin.Id, string.Empty));

            // *** Assert ***
            var activatedAdmin = AdminQueries.GetAdminById(admin.Id);

            Assert.IsNotNull(activatedAdmin);
            Assert.True(activatedAdmin.IsActive == true);
        }
Beispiel #6
0
 public ReportsControllerMethods(Mailer mailer, SiteQueries siteQueries, AdminQueries adminQueries)
 {
     _mailer       = mailer;
     _siteQueries  = siteQueries;
     _adminQueries = adminQueries;
 }
Beispiel #7
0
 public ReportsController(Mailer mailer, SiteQueries siteQueries, AdminQueries adminQueries)
 {
     _mailer  = mailer;
     _methods = new ReportsControllerMethods(mailer, siteQueries, adminQueries);
 }
Beispiel #8
0
 public AdminController(AdminQueries _adminQueries, Mailer _mailer, IHttpContextAccessor httpContextAccesssor)
 {
     adminQueries = _adminQueries;
     methods      = new AdminControllerMethods(adminQueries, _mailer, httpContextAccesssor);
 }
Beispiel #9
0
 public SiteAuth(AdminQueries _dbQueryA, SiteQueries _dbQueryS, DataLimiter dataLimiter) : base(_dbQueryA)
 {
     dbQueryS     = _dbQueryS;
     _dataLimiter = dataLimiter;
 }
Beispiel #10
0
 public Auth(AdminQueries _dbQueryA)
 {
     dbQueryA = _dbQueryA;
 }
Beispiel #11
0
 public SiteController(SiteQueries _SiteQueries, AdminQueries _AdminQueries)
 {
     methods = new SiteControllerMethods(_SiteQueries, _AdminQueries);
 }
Beispiel #12
0
 private int _site_container_size = 0; //may be increased
 public DataLimiter(AdminQueries dbQuery)
 {
     _dbQuery = dbQuery;
 }
Beispiel #13
0
 public UserAdmin GetAdmin(Guid id)
 {
     return(_context.Admin.AsNoTracking().FirstOrDefault(AdminQueries.GetAdminById(id)));
 }
Beispiel #14
0
 public RegistrationValidator(AdminQueries _dbQuery)
 {
     dbQuery = _dbQuery;
 }