public BetRepoIntegrationTestSetup()
        {
            var connectionString = new ConnectionStringsForTest().GetConnectionString("master");

            new DatabaseHelperFactory().GetDatabaseHelperForType(Factories.Database.Main, connectionString, DatabaseName).ResetDatabase();
            InitTest().Wait();
        }
        public async void WholeFlowInOneTest()
        {
            var connectionString   = new ConnectionStringsForTest().GetConnectionString(_setup.DatabaseName);
            var databaseConnection = new DatabaseConnection(connectionString);

            var fakedFactory = A.Fake <IDatabaseConnectionFactory>();

            A.CallTo(() => fakedFactory.GetDatabaseConnection(Factories.Database.Settings)).Returns(databaseConnection);

            var settingsRepo = new SettingRepoService(fakedFactory);

            await settingsRepo.SetSettingsAsync(new DatabaseModel.Settings(100, new decimal(14), 10, DateTime.Today, 20));

            var res = await settingsRepo.GetSettingsAsync();

            Assert.Equal(100, res.InventoryLimit);
            Assert.Equal(new decimal(14), res.ItemValueLimit);
            Assert.Equal(10, res.SteamInventoryCacheTimerInSec);
            Assert.Equal(DateTime.Today, res.UpdatedPricingTime);
            Assert.Equal(20, res.NrOfLatestChatMessages);

            await settingsRepo.SetSettingsAsync(new DatabaseModel.Settings(10, new decimal(1337), 5, DateTime.Today, 10));

            var res2 = await settingsRepo.GetSettingsAsync();

            Assert.Equal(10, res2.InventoryLimit);
            Assert.Equal(new decimal(1337), res2.ItemValueLimit);
            Assert.Equal(5, res2.SteamInventoryCacheTimerInSec);
            Assert.Equal(DateTime.Today, res2.UpdatedPricingTime);
            Assert.Equal(10, res2.NrOfLatestChatMessages);
        }
Beispiel #3
0
        public LevelRepoIntegrationTest(LevelRepoIntegrationTestSetup setup)
        {
            var connectionString = new ConnectionStringsForTest().GetConnectionString(setup.DatabaseName);
            var database         = new DatabaseConnection(connectionString);
            var fakedFactory     = A.Fake <IDatabaseConnectionFactory>();

            A.CallTo(() => fakedFactory.GetDatabaseConnection(Factories.Database.Settings)).Returns(database);
            _levelService = new LevelRepoService(fakedFactory, new LevelQueries());
        }
        protected virtual async Task InitTest()
        {
            var connectionString = new ConnectionStringsForTest().GetConnectionString("master");

            new DatabaseHelperFactory().GetDatabaseHelperForType(Factories.Database.Main, connectionString, DatabaseName).ResetDatabase();

            _connectionString = new ConnectionStringsForTest().GetConnectionString(DatabaseName);
            Database          = new DatabaseConnection(_connectionString);

            FakedFactory = A.Fake <IDatabaseConnectionFactory>();
            A.CallTo(() => FakedFactory.GetDatabaseConnection(Factories.Database.Main)).Returns(Database);
        }
Beispiel #5
0
        public UserRepoIntegrationTest(UserRepoIntegrationTestSetup setup)
        {
            var connectionString   = new ConnectionStringsForTest().GetConnectionString(setup.DatabaseName);
            var databaseConnection = new DatabaseConnection(connectionString);
            var userRepository     = new QueryFactory().UserQueries;

            var fakedFactory = A.Fake <IDatabaseConnectionFactory>();

            A.CallTo(() => fakedFactory.GetDatabaseConnection(Factories.Database.Main)).Returns(databaseConnection);

            _userRepoService = new UserRepoService(fakedFactory, userRepository);
        }
        public ItemRepoIntegrationTestSetup()
        {
            var connectionString = new ConnectionStringsForTest().GetConnectionString("master");

            ConnectionString = new ConnectionStringsForTest().GetConnectionString(DatabaseName);
            Database         = new DatabaseConnection(ConnectionString);
            var fakedFactory = A.Fake <IDatabaseConnectionFactory>();

            A.CallTo(() => fakedFactory.GetDatabaseConnection(Factories.Database.Main)).Returns(Database);
            DatabaseConnectionFactory = fakedFactory;

            new DatabaseHelperFactory().GetDatabaseHelperForType(Factories.Database.Main, connectionString, DatabaseName).ResetDatabase();

            InitTest().Wait();
        }
Beispiel #7
0
        public StaffRepoIntegrationTestSetup()
        {
            var connectionString = new ConnectionStringsForTest().GetConnectionString("master");

            new DatabaseHelperFactory().GetDatabaseHelperForType(Factories.Database.Settings, connectionString, DatabaseName).ResetDatabase();
        }
        public SettingRepoServiceTestSetup()
        {
            var connectionString = new ConnectionStringsForTest().GetConnectionString("master");

            new DatabaseHelperFactory().GetDatabaseHelperForType(Database.Settings, connectionString, DatabaseName).ResetDatabase();
        }