public void SetUp() { var fixture = new Fixture(); _ukprn = fixture.Create <long>(); _uln = fixture.Create <long>(); _jobId = fixture.Create <long>(); _academicYear = fixture.Create <short>(); _collectionPeriod = fixture.Create <byte>(); _datalockEvent = fixture.Create <DatalockEvent>(); _datalockEvent.PayablePeriods.Clear(); _datalockEvent.NonPayablePeriods.Clear(); _datalockEvent.PriceEpisodes.Clear(); _latestSuccessfulJob = fixture.Create <LatestSuccessfulJobModel>(); _latestSuccessfulJob.Ukprn = _ukprn; _latestSuccessfulJob.AcademicYear = _academicYear; _latestSuccessfulJob.CollectionPeriod = _collectionPeriod; _latestSuccessfulJob.DcJobId = _jobId; _datalockEventNonPayablePeriod = fixture.Create <DatalockEventNonPayablePeriod>(); _datalockEventPayablePeriod = fixture.Create <DatalockEventPayablePeriod>(); _datalockEventPriceEpisode = fixture.Create <DatalockEventPriceEpisode>(); _context = new PaymentsContext(new DbContextOptionsBuilder <PaymentsContext>() .UseInMemoryDatabase("TestDb", new InMemoryDatabaseRoot()) .Options); _sut = new PaymentsDataLockRepository(_context); }
public MerchantsRepository(PaymentsContext paymentsContext) { _paymentsContext = paymentsContext; if (!_paymentsContext.Merchants.Any()) { _paymentsContext.AddRange( new Merchant { ApiKey = "84e3868bd19b48d7b2c2c1a420afca96", EncryptionKey = "abcd1234$%^&8765£$%^poiu", CompanyName = "PaperShop", ContactName = "Ian Papier", EmailAddress = "*****@*****.**", }, new Merchant { ApiKey = "51453ab10b194cea9004da4501f846fc", EncryptionKey = "8765£$%^poiuabcd1234$%^&", CompanyName = "Peanuts R Us", ContactName = "Alex Nutter", EmailAddress = "*****@*****.**", }); _paymentsContext.SaveChanges(); } }
// Called by Runtime. Use it to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { // Auto create db : using (IServiceScope scope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope()) { PaymentsContext context = scope.ServiceProvider.GetRequiredService <PaymentsContext>(); context.Database.EnsureCreated(); } if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Payments}/{action=Index}/{id?}"); }); }
public PaymentServiceTests() { var context = new PaymentsContext(true); IPaymentUniqueIDBuilder <PaymentData> builder = new PaymentMd5UniqueId(); PaymentsDatabaseRepository repo = new PaymentsDatabaseRepository(context, builder); _paymentService = new PaymentService(repo); }
public UnitOfWorkCommandHandlerDecorator( ICommandHandler <T> decorated, IUnitOfWork unitOfWork, PaymentsContext paymentsContext) { _decorated = decorated; _unitOfWork = unitOfWork; _paymentsContext = paymentsContext; }
public static void Seed(DbContextOptions <PaymentsContext> options) { using (var context = new PaymentsContext(options)) { context.ProductLocales.AddRange(PaymentsStaticDataProdiver.ProductLocales); context.Products.AddRange(PaymentsStaticDataProdiver.Products); context.SaveChanges(); } }
public ProductLocaleTest() { var options = new DbContextOptionsBuilder <PaymentsContext>() .UseInMemoryDatabase("products_locale_test") .Options; DataSeeder.Seed(options); var context = new PaymentsContext(options); context.Database.EnsureCreated(); _productRepository = new ProductRepository(context); }
public PaymentsServiceTest() { var configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json").Build(); var configurationProvider = new PayPalConfigurationProvider(configuration); var payPalService = new PayPalService(configurationProvider); var options = new DbContextOptionsBuilder <PaymentsContext>() .UseInMemoryDatabase("payments_service_test") .Options; var context = new PaymentsContext(options); DataSeeder.Seed(options); _unitOfWork = new PaymentsUnitOfWork(context); _paymentsService = new PaymentsService(payPalService, _unitOfWork); }
public CardsController(PaymentsContext context) { _context = context; }
internal OutboxAccessor(PaymentsContext meetingsContext) { _meetingsContext = meetingsContext; }
public PayerRepository(PaymentsContext paymentsContext) { _paymentsContext = paymentsContext; }
public HomeController(ILogger <HomeController> logger, PaymentsContext dbContext) { _dbContext = dbContext; _logger = logger; }
public SqlHealthcheck(PaymentsContext paymentsContext) { _paymentsContext = paymentsContext; }
public PaymentsController(IOptions <AppStaticValues> appValues, PaymentsContext context) { _dbContext = context; _appValues = appValues.Value; }
public SubscriptionRepository(PaymentsContext context) : base(context) { }
public PaymentRepository(PaymentsContext context, IMapper iMapper) { _context = context; _iMapper = iMapper; }
public AccountsController(PaymentsContext context) { _context = context; }
public DataController(PaymentsContext dbContext) { _dbContext = dbContext; }
public static void Initialize(PaymentsContext context) { if (!context.Users.Any()) { context.Users.AddRange( new User { IsAdmin = false, Name = "Nikolay", Surname = "Amusin", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = true, Name = "Ivan", Surname = "Ivanov", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Kirill", Surname = "Stepanov", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Andrei", Surname = "Spiridonov", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Ivan", Surname = "Litvinov", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Alexei", Surname = "Platonov", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Nikolay", Surname = "Andreev", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Konstantin", Surname = "Kom", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = true, Name = "Konstantin", Surname = "Kurochka", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = true, Name = "Igor", Surname = "Stefanovskiy", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Kirill", Surname = "Sidorov", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Kseniya", Surname = "Zlotnikova", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Ilya", Surname = "Puninskiy", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Alexandr", Surname = "Anosov", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Nikolay", Surname = "Ropot", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Ivan", Surname = "Kosov", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Oleg", Surname = "Ivanov", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Alexey", Surname = "Kachan", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Sergei", Surname = "Gusakov", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Alexandr", Surname = "Obrezkov", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Dmitriy", Surname = "Kozintsov", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Oleg", Surname = "Asenchik", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Pavel", Surname = "Shur", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Viktoriya", Surname = "Belous", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Vladislav", Surname = "Volotkovich", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = true, Name = "Denis", Surname = "Trubenok", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Alesya", Surname = "Lizogub", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Vitaliy", Surname = "Belodedov", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Diana", Surname = "Korniluk", Email = "*****@*****.**", Password = "******" }, new User { IsAdmin = false, Name = "Yana", Surname = "Kislyak", Email = "*****@*****.**", Password = "******" }); context.SaveChanges(); } double[] balances = new Double[1300]; for (int i = 0; i < balances.Length; i++) { balances[i] = new Random().Next(20, 250); } if (!context.Cards.Any()) { for (int i = 1, k = 0; i <= 30; i++) { for (int j = 0; j < 35; j++, k++) { context.Cards.Add(new Card { UserId = i, Balance = balances[k] }); } } context.SaveChanges(); } if (!context.Accounts.Any()) { for (int i = 1, j = 0; i <= 1000; i++, j++) { context.Accounts.Add(new Account { CardId = i, IsBlocked = false, Balance = balances[j] }); } context.SaveChanges(); } if (!context.Goals.Any()) { context.Goals.AddRange( new Goal { GoalName = "Learning" }, new Goal { GoalName = "Gym" }, new Goal { GoalName = "BRSM" }, new Goal { GoalName = "TV" }, new Goal { GoalName = "Phone" }, new Goal { GoalName = "Bank" }, new Goal { GoalName = "Shop" }, new Goal { GoalName = "Oil" }, new Goal { GoalName = "Tax" }, new Goal { GoalName = "Credit" }, new Goal { GoalName = "Penalty" }, new Goal { GoalName = "Cinema" }, new Goal { GoalName = "Teacher" }, new Goal { GoalName = "Software" }, new Goal { GoalName = "Retake" }, new Goal { GoalName = "Communal" }, new Goal { GoalName = "Home" }, new Goal { GoalName = "Pool" }, new Goal { GoalName = "Referee" }, new Goal { GoalName = "Project" }, new Goal { GoalName = "Water" }, new Goal { GoalName = "Hostel" }, new Goal { GoalName = "Dormitory" }, new Goal { GoalName = "Mortage" }, new Goal { GoalName = "Game" }, new Goal { GoalName = "Microsoft Office" }, new Goal { GoalName = "Matlab" }, new Goal { GoalName = "Notebook" }, new Goal { GoalName = "Garage" }, new Goal { GoalName = "Parking" }); context.SaveChanges(); } if (!context.Payments.Any()) { for (int i = 1; i <= 1000; i++) { context.Payments.Add(new Payment { AccountId = new Random().Next(1, 1000), GoalId = new Random().Next(1, 30), Date = "01/01/201" + new Random().Next(1, 9), Amount = new Random().Next(10, 150) }); } context.SaveChanges(); } }
public GoalsController(PaymentsContext context) { _context = context; }
public PaymentsDatabaseRepository(PaymentsContext context, IPaymentUniqueIDBuilder <PaymentData> uniqueIdBuilder) { _context = context; _uniqueIdBuilder = uniqueIdBuilder; }
public ProductRepository(PaymentsContext context) : base(context) { }
public UsersController(PaymentsContext context) { StartData.Initialize(context); _context = context; }
public PaymentsRepository(PaymentsContext paymentsContext, ILogger <PaymentsRepository> logger) { _paymentsContext = paymentsContext; _logger = logger; }
internal MeetingGroupPaymentRegisterRepository(PaymentsContext paymentsContext) { _paymentsContext = paymentsContext; }
public CategoriesController(DbContextOptions <PaymentsContext> options, PaymentsContext dbContext) { _options = options; _dbContext = dbContext; }
internal MeetingPaymentRepository(PaymentsContext paymentsContext) { _paymentsContext = paymentsContext; }
public PayPalPlanRepository(PaymentsContext context) : base(context) { }
public PaymentsRepository(PaymentsContext context) { _context = context; }
public PaymentsController(IOptions <AppSettings> ASettings, PaymentsContext ADBContext) { this.Settings = ASettings; DBContext = ADBContext; }