public PlayerProgressRepositoryTests()
        {
            _contextFactory = new QuestEngineContextFactory(
                new ContextConfiguration
            {
                InMemoryDb = true
            });

            _context = _contextFactory.Create();

            _context.PlayerProgresses.AddRange(new[]
            {
                new PlayerProgress
                {
                    QuestId           = 1,
                    PlayerId          = "player1",
                    QuestPointsEarned = 1,
                },
                new PlayerProgress
                {
                    QuestId           = 2,
                    PlayerId          = "player1",
                    QuestPointsEarned = 2
                },
                new PlayerProgress
                {
                    QuestId           = 1,
                    PlayerId          = "player2",
                    QuestPointsEarned = 3
                }
            });

            _context.SaveChanges();
        }
        public IntegrationTestsBase()
        {
            var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();

            QuestEngineServer = new TestServer(new WebHostBuilder()
                                               .UseEnvironment("Develpment")
                                               .UseConfiguration(configuration)
                                               .UseStartup <Startup>());

            TestHttpClient = QuestEngineServer.CreateClient();

            Context                 = QuestEngineServer.Host.Services.GetService <QuestEngineContext>();
            GameConfiguration       = QuestEngineServer.Host.Services.GetService <GameConfiguration>();
            MilestoneConfigurations = QuestEngineServer.Host.Services.GetService <IReadOnlyCollection <Milestone> >();
        }
Esempio n. 3
0
 public PlayerProgressRepository(QuestEngineContext context)
 {
     _context = context;
 }