public DelegationBuilderCommitteeSelector(MunityContext context, string conferenceId, int countryId, Delegation delegation) { this._dbContext = context; this._conferenceId = conferenceId; this.Delegation = delegation; this._countryId = countryId; }
public void SetupTests() { var loggerMock = new Mock <ILogger <ResolutionService> >(); dbContext = TestHelpers.CreateSQLiteContext("resolutiontests"); service = new ResolutionService(dbContext, loggerMock.Object); }
//public async Task<object> Login(MunityUser user) //{ // var signIn = await signInManager.SignIn(user, true); //} public UserService(MunityContext context, UserManager <MunityUser> userManager, IMailService mailService, ILogger <UserService> logger) { this.context = context; this.userManager = userManager; this._logger = logger; this._mailService = mailService; }
public void SetupDatabase() { var serviceCollection = new ServiceCollection(); serviceCollection.AddDbContext <MunityContext>(options => options.UseSqlite("Data Source=testmunbw.db")); serviceCollection.AddIdentity <MunityUser, MunityRole>(options => { options.User.RequireUniqueEmail = true; options.Password.RequireDigit = true; options.Password.RequireLowercase = true; options.Password.RequireUppercase = true; options.Password.RequireNonAlphanumeric = false; }) .AddEntityFrameworkStores <MunityContext>(); // Needed to get the Identity Provider to run! serviceCollection.AddLogging(); this._serviceProvider = serviceCollection.BuildServiceProvider(); // Reset the Database. _context = _serviceProvider.GetRequiredService <MunityContext>(); _context.Database.EnsureDeleted(); _context.Database.EnsureCreated(); }
public void Setup() { var optionsBuilder = new DbContextOptionsBuilder <MunityContext>(); optionsBuilder.UseSqlite("Data Source=test_conference.db"); _context = new MunityContext(optionsBuilder.Options); _context.Database.EnsureDeleted(); _context.Database.EnsureCreated(); }
public void Setup() { // Datenbank für den Test erzeugen und falls vorhanden erst einmal leeren und neu erstellen! var optionsBuilder = new DbContextOptionsBuilder <MunityContext>(); optionsBuilder.UseSqlite("Data Source=test_conference.db"); _context = new MunityContext(optionsBuilder.Options); ResetDatabase(); }
public static int SetupBaseRoles(this MunityContext context) { if (!context.Roles.Any()) { foreach (var munityRole in BaseData.DefaultAuthorizations.UserRoles) { context.Roles.Add(munityRole); } } return(context.SaveChanges()); }
public static MunityContext CreateSQLiteContext(string name) { // Datenbank für den Test erzeugen und falls vorhanden erst einmal leeren und neu erstellen! var optionsBuilder = new DbContextOptionsBuilder <MunityContext>(); optionsBuilder.UseSqlite($"Data Source={name}.db"); var context = new MunityContext(optionsBuilder.Options); context.Database.EnsureDeleted(); context.Database.EnsureCreated(); return(context); }
public RegisterModel( UserManager <MunityUser> userManager, SignInManager <MunityUser> signInManager, ILogger <RegisterModel> logger, IMailService emailSender, MunityContext context) { _userManager = userManager; _signInManager = signInManager; _logger = logger; _emailSender = emailSender; _dbContext = context; }
public DelegationApplicationBuilder(MunityContext context, string conferenceId) { this._context = context; this.conferenceId = conferenceId; this.application = new DelegationApplication() { DelegationWishes = new List <DelegationApplicationPickedDelegation>(), Users = new List <DelegationApplicationUserEntry>(), FormulaInputs = new List <ConferenceDelegationApplicationFieldInput>(), ApplyDate = DateTime.Now, OpenToPublic = false, Status = ApplicationStatuses.Writing, Conference = context.Conferences.Find(conferenceId) }; }
public DelegationBuilder(MunityContext context, string conferenceId) { this._dbContext = context; this._conferenceId = conferenceId; var conference = _dbContext.Conferences.Find(conferenceId); if (conference == null) { throw new ConferenceNotFoundException($"No conference with the id {conferenceId} found!"); } this.Delegation = new Delegation() { Conference = conference, Roles = new List <ConferenceDelegateRole>() }; }
public void Setup() { // Datenbank für den Test erzeugen und falls vorhanden erst einmal leeren und neu erstellen! var optionsBuilder = new DbContextOptionsBuilder <MunityContext>(); optionsBuilder.UseSqlite("Data Source=test_conferenceRoles.db"); _context = new MunityContext(optionsBuilder.Options); _context.Database.EnsureDeleted(); _context.Database.EnsureCreated(); organization = new Organization() { OrganizationName = "Test Organization", OrganizationShort = "TO" }; project = new Project() { ProjectName = "Test Project", ProjectOrganization = organization, ProjectShort = "TP", }; conference = new Conference() { ConferenceProject = project, ConferenceShort = "TC", CreationDate = DateTime.Now, EndDate = new DateTime(2021, 1, 4), StartDate = new DateTime(2021, 1, 1), FullName = "Test Conference", Name = "Test Conference" }; var committee = new Committee() { Article = "die", CommitteeShort = "GV", Conference = conference, FullName = "Generalversammlung", Name = "Generalversammlung" }; _context.Organizations.Add(organization); _context.Projects.Add(project); _context.Conferences.Add(conference); _context.Committees.Add(committee); _context.SaveChanges(); }
/// <summary> /// Adds the countries that are given to the Database. If a country already has the given name it /// will just update the country. /// </summary> /// <param name="context"></param> /// <param name="countries"></param> /// <returns></returns> public static int AddBaseCountries(this MunityContext context, IEnumerable <Country> countries) { foreach (var country in countries) { var matchingCountry = context.Countries.Include(n => n.Translations).FirstOrDefault(n => n.Name == country.Name); if (matchingCountry != null) { // Update the country matchingCountry.FullName = country.FullName; matchingCountry.Iso = country.Iso; if (country.Continent != EContinent.NotSet) { matchingCountry.Continent = country.Continent; } if (country.Translations.Count > 0) { foreach (var translation in country.Translations) { var foundTranslation = matchingCountry.Translations.FirstOrDefault(n => n.LanguageCode == translation.LanguageCode); if (foundTranslation != null) { foundTranslation.TranslatedName = translation.TranslatedName; foundTranslation.TranslatedFullName = translation.TranslatedFullName; } } } } else { context.Countries.Add(country); } } return(context.SaveChanges()); }
public ResolutionService(MunityContext context, ILogger <ResolutionService> logger) { this._context = context; this._logger = logger; }
public void Dispose() { this._context?.Dispose(); this._context = null; _logger.LogDebug("A ResolutionService has been disposed!"); }
public ConferenceApplicationService(MunityContext context, ILogger <ConferenceApplicationService> logger) { this._dbContext = context; this._logger = logger; }
public OrganizationTools(MunityContext context) { this.DbContext = context; }
public ConferenceOptionsBuilder(MunityContext context, Project project = null) { this._conference = new Conference(); this._context = context; this._conference.ConferenceProject = project; }
public void SetUp() { this._context = MunityContext.FromSqlLite("settingTest"); _context.Database.EnsureDeleted(); _context.Database.EnsureCreated(); }
public ProjectTools(MunityContext context) { _dbContext = context; }
public CommitteeSpecificTools(MunityContext context, [NotNull] string committeeId) { this._dbContext = context; this._committeeId = committeeId; }
public ConferenceWebsiteService(MunityContext context) { _context = context; }
public OrganizationOptionsBuilder(MunityContext context) { this._context = context; this.Organization = new Organization(); }
public BuildReadyDelegationBuilder(MunityContext context, Delegation delegation) { this._context = context; this.Delegation = delegation; }
public UserConferenceAuthService(MunityContext context, UserManager <MunityUser> userManager) { this.context = context; this.userManager = userManager; }
public ConferenceService(MunityContext context, UserConferenceAuthService authService, ILogger <ConferenceService> logger) { this.context = context; this.authService = authService; this._logger = logger; }
public ProjectOptionsBuilder(MunityContext context, Organization organization = null) { this.Project = new Project(); this._context = context; this.Project.ProjectOrganization = organization; }
public FluentProvider(MunityContext context) { this.DbContext = context; }
public void ReloadContextToClearBuffer() { _context = _serviceProvider.GetRequiredService <MunityContext>(); }
public ConferenceTools(MunityContext context) { this._dbContext = context; }