public void LoadTenantsShouldReturnAllTenants() { var options = new DbContextOptionsBuilder <UsersDbContext>() .UseInMemoryDatabase(databaseName: "LoadTenantsShouldReturnAllTenants") .Options; // Insert seed data into the database using one instance of the context using (var ctx = new UsersDbContext(options)) { //the seed is adding 2 tenants by default ctx.Database.EnsureCreated(); ctx.Tenants.Add(new Tenant() { TenantId = 3, Domain = "asd.com" }); ctx.SaveChanges(); } // Use a clean instance of the context to run the test using (var ctx = new UsersDbContext(options)) { var repo = new TenantsRepository(ctx); var tenants = repo.LoadTenants().Result.OrderBy(t => t.TenantId); Assert.AreEqual(3, tenants.Count(), "Not all tenants are returned"); Assert.IsTrue(tenants.Last().Domain == "asd.com", "Tenant domain should be returned"); } }
public TenantProvider(ApplicationContext initial, TenantsRepository tenantsRepository) { _tenantsRepository = tenantsRepository; _contexts = new Stack <ApplicationContext>(); _contexts.Push(initial); }
public static async Task Main(string[] args) { var repo = new TenantsRepository(ConfigurationManager.AppSettings["atlasConnectionString"]); repo.InsertTenant(); Console.WriteLine("Finished updating the product collection"); Console.ReadKey(); }
static void Main() { Console.Write("Informe o alias do tenant: "); var tenantAlias = Console.ReadLine(); Console.Write("Informe o nome do tenant: "); var tenantBusiness = Console.ReadLine(); Console.Write("Informe a url para database do tenant: "); var tenantDatabase = Console.ReadLine(); var urlDatabase = "http://gabriel-nt:8080"; var repository = new TenantsRepository(urlDatabase); var tenant = Tenant.Create(tenantAlias, tenantBusiness, tenantDatabase); repository.Save(tenant); var canExit = false; while (!canExit) { Console.WriteLine("Inclusão de fatura"); Console.WriteLine(""); Console.Write("Informe o nome do cliente: "); var clientInfo = Console.ReadLine(); Console.Write("Informe o valor da fatura: "); var ammount = Convert.ToDecimal(Console.ReadLine()); var invoice = Invoice.Create(clientInfo, ammount); var invoiceRepository = new InvoicesRepository(tenant); invoiceRepository.Save(invoice); Console.WriteLine(); Console.Write("Incluir outra invoice? "); var pressKey = Console.ReadKey(); if (pressKey.Key == ConsoleKey.N) { canExit = true; } Console.Clear(); } Console.Read(); }
public TenantsController(TenantsRepository tenantsRepository, ApplicationUsersRepository applicationUsersRepository, ApplicationUserValidators userValidators) { _TenantsRepository = tenantsRepository; _ApplicationUsersRepository = applicationUsersRepository; _UserValidators = userValidators; }
public TenantsController(TenantsRepository tenantsRepository) { _TenantsRepository = tenantsRepository; }
public TenantsService(int tenantID, TenantsRepository tenantsRepository) { }