public Bot(DiscordSocketClient client, CommandService commands, IConfigurationRoot configuration, IServiceProvider services, IRepository repository, JsonRepository <GypsyModel> gypsyRepository, GypsyContext dbContext, GypsyService gypsyService) { // It is recommended to Dispose of a client when you are finished // using it, at the end of your app's lifetime. _client = client; _commands = commands; _services = services; _repository = repository; _dbContext = dbContext; _gypsyService = gypsyService; _client.Log += LogAsync; _client.Ready += ReadyAsync; _client.MessageReceived += HandleCommandAsync; _discordToken = configuration["discordToken"]; _spawnRate = configuration.GetValue <int>("SpawnRate"); _prefix = configuration.GetValue <string>("Prefix"); _gypsyModels = gypsyRepository.GetAll().Result; }
public void TestGetAll() { JsonRepository<TestEntity> repo = new JsonRepository<TestEntity>(); int id = 1; TestEntity te = new TestEntity(id); repo.Save(te); id = 2; te = new TestEntity(id); repo.Save(te); id = 3; te = new TestEntity(id); repo.Save(te); repo = new JsonRepository<TestEntity>(); var fromFiles = repo.GetAll().ToList(); Assert.IsTrue(fromFiles.Count == 3); Directory.Delete(repo.FolderPath, true); }
public void TestGetAll() { JsonRepository <TestEntity> repo = new JsonRepository <TestEntity>(); int id = 1; TestEntity te = new TestEntity(id); repo.Save(te); id = 2; te = new TestEntity(id); repo.Save(te); id = 3; te = new TestEntity(id); repo.Save(te); repo = new JsonRepository <TestEntity>(); var fromFiles = repo.GetAll().ToList(); Assert.IsTrue(fromFiles.Count == 3); Directory.Delete(repo.FolderPath, true); }