public static async Task <DatnekContext> GetDatabaseContext() { var options = new DbContextOptionsBuilder <DatnekContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; var phonebookContext = new DatnekContext(options); return(await Task.Run(() => phonebookContext)); }
public async Task <User> GetUser(DatnekContext datnekContext) { var usersService = new UsersService(datnekContext, Options.Create(new AppSettings())); usersService.setAppSettings(new AppSettings() { Secret = "datnek-language-adb8-4ce5-aa49-7test2020256" }); var user = new User() { slug = "123", username = "******", email = "*****@*****.**", password = "******" }; return(await usersService.Create(user)); }
public LanguagesService(DatnekContext context) { this.context = context; }
public UsersService(DatnekContext context, IOptions <AppSettings> appSettings) { this.context = context; this.appSettings = appSettings?.Value; }