public async Task SmallAccount() { Assert.True(true); return; //Arrange string serviceId = "serviceId"; Account originalAccount = await DefaultAccountFactoryService.CreateDefaultAccountAsync(serviceId); int originalAccountSoftCurrency = originalAccount.GetAccountSoftCurrency(); int warshipId = originalAccount.Warships.First().Id; int warshipPowerPoints = originalAccount.GetWarshipPowerPoints(warshipId); int warshipPowerLevel = originalAccount.GetWarshipPowerLevel(warshipId); //Act bool canAPurchaseBeMade = WarshipImprovementCostChecker .CanAPurchaseBeMade(originalAccountSoftCurrency, warshipPowerPoints, warshipPowerLevel, out var faultReason); Console.WriteLine($"{nameof(canAPurchaseBeMade)} = {canAPurchaseBeMade}"); bool success = await WarshipImprovementFacadeService.TryBuyLevel(originalAccount.ServiceId, warshipId); //Assert Assert.IsTrue(success); }
public static void Initialize() { Console.WriteLine("Initialization"); IDbConnectionConfig dbConnectionConfig = new DbConnectionConfig(DatabaseName); //Создать БД dbContextFactory = new DbContextFactory(dbConnectionConfig); DbContext = dbContextFactory.Create(DatabaseName); //Ввести базовые данные var seeder = new DataSeeder(); seeder.Seed(DbContext); //Прервать текущие сессии DbContext.Accounts.FromSql(new RawSqlString("ALTER DATABASE {0} SET postgres WITH ROLLBACK IMMEDIATE"), DatabaseName); //Очиста аккаунта TruncateAccountsTable(); string connectionString = dbConnectionConfig.GetConnectionString(); //Создать сервисы NpgsqlConnection npgsqlConnection = new NpgsqlConnection(connectionString); ISkinsDbReaderService skinsDbReaderService = new SkinsDbReaderService(DbContext); IDbWarshipsStatisticsReader dbWarshipsStatisticsReader = new DbWarshipsStatisticsReader(npgsqlConnection); IDbAccountWarshipReaderService dbAccountWarshipReaderService = new DbAccountWarshipReaderService(dbWarshipsStatisticsReader, skinsDbReaderService); AccountResourcesDbReader accountResourcesDbReader = new AccountResourcesDbReader(npgsqlConnection); AccountReaderService = new AccountDbReaderService(dbAccountWarshipReaderService, accountResourcesDbReader); NotShownRewardsReaderService = new NotShownRewardsReaderService(DbContext); DefaultAccountFactoryService = new DefaultAccountFactoryService(DbContext); var accountRegistrationService = new AccountRegistrationService(DefaultAccountFactoryService); var warshipsCharacteristicsService = new WarshipsCharacteristicsService(); AccountMapperService accountMapperService = new AccountMapperService(warshipsCharacteristicsService); AccountFacadeService = new AccountFacadeService(AccountReaderService, accountRegistrationService); var bundleVersionService = new BundleVersionService(); LobbyModelFacadeService = new LobbyModelFacadeService(AccountFacadeService, NotShownRewardsReaderService, accountMapperService, bundleVersionService); UsernameValidatorService usernameValidatorService = new UsernameValidatorService(); UsernameChangingService usernameChangingService = new UsernameChangingService(usernameValidatorService, DbContext); LobbyModelController = new LobbyModelController(LobbyModelFacadeService, usernameChangingService); WarshipImprovementCostChecker = new WarshipImprovementCostChecker(); WarshipImprovementFacadeService = new WarshipImprovementFacadeService(AccountReaderService, DbContext, WarshipImprovementCostChecker); }
public WarshipImprovementPurchasingController(WarshipImprovementFacadeService warshipImprovementFacadeService) { this.warshipImprovementFacadeService = warshipImprovementFacadeService; }
public WarshipLevelController(WarshipImprovementFacadeService warshipImprovementFacadeService) { this.warshipImprovementFacadeService = warshipImprovementFacadeService; }