public void GetCardsPassed() { // Arrange var mock = new Mock <IBankRepository>(); var mockCards = new FakeDataGenerator(_businessLogicService).GenerateFakeCards(); mock.Setup(r => r.GetCards()).Returns(mockCards); var controller = new CardsController(mock.Object, _cardService, _businessLogicService); // Test var cards = controller.Get(); // Assert mock.Verify(r => r.GetCards(), Times.AtMostOnce()); Assert.Equal(3, cards.Count()); }
public void InsertGetBytesTest(int iteration) { var key = FakeDataGenerator.RandomString(iteration); var length = new Random().Next(iteration); var value = new byte[iteration]; new Random().NextBytes(value); var coreAppSettings = new PrivateWiki.Services.KeyValueCaches.InMemoryCache(); coreAppSettings.InsertBytes(key, value); var actual = coreAppSettings.GetBytes(key); Assert.Equal(value, actual.Value); }
public async void InsertGetObjectsTest() { var key = FakeDataGenerator.RandomString(10); var value = new TestObject(); await _cache.InsertAsync(key, value); var result = await _cache.GetObjectAsync <TestObject>(key); Assert.True(result.IsSuccess); var actual = result.Value; Assert.Equal(value.test1, actual.test1); Assert.Equal(value.test2, actual.test2); Assert.Equal(value.test3, actual.test3); }
public async void InsertGetObjectsTest() { var key = FakeDataGenerator.RandomString(10); var value = new TestObject(); var coreAppSettings = new PrivateWiki.Services.KeyValueCaches.InMemoryCache(); await coreAppSettings.InsertAsync(key, value); var result = await coreAppSettings.GetObjectAsync <TestObject>(key); Assert.True(result.IsSuccess); var actual = result.Value; Assert.Equal(value.test1, actual.test1); Assert.Equal(value.test2, actual.test2); Assert.Equal(value.test3, actual.test3); }
public Setor OCadastroRapidoDoDepartamentoComSetorESecao(string idEmpresa) { string idGeneral = Guid.NewGuid().ToString(); Departamento Departamento = OCadastroRapidoDoDepartamento(idEmpresa); Setor Setor = new Setor { id = idGeneral, idDepartamento = Departamento.id, idTipoLotacao = "BAB0F96D-F8ED-47B6-85CA-680D548B2A32", descricao = FakeDataGenerator.FakeDescricao(50) }; Setor = JsonConvert.DeserializeObject <Setor>(Services.POST(ServiceConfig.GetUrlAdm() + "/hypercube_adm/v1/setor", JsonConvert.SerializeObject(Setor))); Setor.DepartamentoReference = Departamento; return(Setor); }
public async Task <IActionResult> Get() { var x = FakeDataGenerator.GetAdministrators(); var y = FakeDataGenerator.GetAffiliates(); var z = FakeDataGenerator.GetDoctors(); List <object> persons = new List <object>(); foreach (var item in x) { persons.Add(new { item, type = "Admnistrator" }); } foreach (var item in y) { persons.Add(new { item, type = "Affiliate" }); } foreach (var item in z) { persons.Add(new { item, type = "Doctors" }); } return(Ok(persons)); }
public IndexModule() { Get["/"] = parameters => { var questions = FakeDataGenerator.CreateFakeQuestions().ToArray(); ViewBag.Header = "Recent questions"; ViewBag.User = new UserViewModel(); return(View["index", questions]); }; #region _ Get["/api"] = parameters => { // See Negotiate for more content negotiation options return(FakeDataGenerator.CreateFakeQuestions()); }; #endregion }
/// <summary> /// Start to sweep PLC data /// </summary> /// <param name="Channel"></param> /// <returns></returns> public Task StartSweepThroughPLC() { PLC.ClearTestedData(); testTime = DateTime.Now; #if !FAKE_ME return(SweepAsync((lambda, list) => { this.PLC.AddTestedData(lambda, list); })); #else FakeDataGenerator.ReadRawData("fakedata.csv", out List <Point> data1, out List <Point> data2, out List <Point> data3, out List <Point> data4); this.PLC.Channels[0].InsertionLoss.AddRange(data1); this.PLC.Channels[1].InsertionLoss.AddRange(data2); this.PLC.Channels[2].InsertionLoss.AddRange(data3); this.PLC.Channels[3].InsertionLoss.AddRange(data4); return(Task.Run(() => { })); #endif }
public Main() { // const string xmlFileName = @"PassFruit.xml"; var xmlFilePath = Path.GetTempFileName(); File.Delete(xmlFilePath); var fileExists = File.Exists(xmlFilePath); var xmlDatastoreConfiguration = new XmlDatastoreConfiguration( () => fileExists ? XDocument.Load(xmlFilePath) : new XDocument(), xDocument => xDocument.Save(xmlFilePath) ); _dataStore = new XmlDatastore(xmlDatastoreConfiguration); if (!fileExists) { var fakeDataGenerator = new FakeDataGenerator(); fakeDataGenerator.GenerateFakeData(_dataStore); } }
public void Setup() { var options = new DbContextOptionsBuilder <AppDbContext>() .UseInMemoryDatabase(databaseName: "SocialAppTestDb").Options; var myProfile = new AutoMapping(); var configuration = new MapperConfiguration(cfg => cfg.AddProfile(myProfile)); var mapper = new Mapper(configuration); _context = new AppDbContext(options); _errorService = new ErrorService(); _postService = new PostService(_context, _errorService, mapper); _fakeData = new FakeDataGenerator(); var user = _fakeData.GetUser(); _context.Add(user); _context.SaveChanges(); _userId = user.Id; _wrongUserId = Guid.NewGuid().ToString(); }
public Departamento OCadastroRapidoDoDepartamento(string idEmpresa) { List <Empresa> Empresas = new List <Empresa>(); Empresas = JsonConvert.DeserializeObject <List <Empresa> >(Services.GET(ServiceConfig.GetUrlAdm() + "/hypercube_adm/v1/empresa/find?id=" + idEmpresa)); string idGeneral = Guid.NewGuid().ToString(); Departamento Departamento = new Departamento { id = idGeneral, idEmpresa = Empresas[0].Id, idTipoLotacao = "BAB0F96D-F8ED-47B6-85CA-680D548B2A32", descricao = FakeDataGenerator.FakeDescricao(50), status = "A" }; Departamento = JsonConvert.DeserializeObject <Departamento>(Services.POST(ServiceConfig.GetUrlAdm() + "/hypercube_adm/v1/departamento", JsonConvert.SerializeObject(Departamento))); return(Departamento); }
public QuestionsModule() : base("/questions") { // For routes, see https://github.com/NancyFx/Nancy/wiki/Defining-routes Get["/view/{id}"] = p => { return(View["View", FakeDataGenerator.CreateAFakeQuestion()]); }; Get["/ask"] = p => { return(View["Ask", new QuestionInputModel()]); }; Post["/ask"] = p => { var question = this.Bind <QuestionInputModel>(); // TODO validate question return("Success"); }; }
public void OnResultExecuting(ResultExecutingContext context) { var viewResult = context.Result as ViewResult; if (viewResult != null) { if (string.IsNullOrEmpty(context.HttpContext.User.Identity.Name)) { viewResult.ViewData["Folders"] = FakeDataGenerator.GenerateFolders(); } else { var userService = context.HttpContext.RequestServices.GetRequiredService <UserService>(); var user = userService.GetUserByEmail(context.HttpContext.User.Identity.Name).GetAwaiter().GetResult(); viewResult.ViewData["Folders"] = user.UserFolders.Select(x => new LayoutUserFoldersModel { DocumentsCount = x.DocumentFolders.Count, Id = x.Id, Name = x.Name }).ToList(); } } }
public ActionResult View(int id) { return(View(FakeDataGenerator.CreateAFakeQuestion())); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { #region MessageConfig modelBuilder.Entity <Message>() .HasOne <User>() .WithMany() .HasForeignKey(p => p.RecipientId); modelBuilder.Entity <Message>() .HasOne <User>() .WithMany() .HasForeignKey(p => p.SenderId); #endregion #region GoodConfig modelBuilder.Entity <Good>() .HasOne <Store>() .WithMany() .HasForeignKey(p => p.StoreId); modelBuilder.Entity <Good>() .HasOne <Category>() .WithMany() .HasForeignKey(p => p.CategoryId); modelBuilder.Entity <Good>() .HasMany <Order>(e => e.Orders) .WithMany(e => e.Goods); modelBuilder.Entity <Good>() .HasOne <Store>() .WithMany() .HasForeignKey(p => p.StoreId); #endregion #region ManagersConfig modelBuilder.Entity <Managers>() .HasOne <User>() .WithMany() .HasForeignKey(p => p.UserId); #endregion #region OrderConfig modelBuilder.Entity <Order>() .HasOne <User>() .WithMany() .HasForeignKey(p => p.UserId); // modelBuilder.Entity<Order>() // .HasMany<Good>(e => e.Goods) // .WithMany(e => e.Orders); #endregion #region StoreConfig modelBuilder.Entity <Store>() .HasOne <User>() .WithMany() .HasForeignKey(p => p.OwnerId); // modelBuilder.Entity<Store>() // .HasMany<Good>() // .WithOne() // .HasForeignKey(e => e.StoreId); #endregion #region UserBasketConfig modelBuilder.Entity <UserBasket>() .HasOne <User>() .WithOne() .HasForeignKey <UserBasket>(e => e.UserId); modelBuilder.Entity <UserBasket>() .HasMany <Good>(p => p.SelectedGoods) .WithMany(e => e.Baskets); #endregion #region OrderConfig modelBuilder.Entity <Order>() .HasMany <Good>(e => e.Goods) .WithMany(e => e.Orders) .UsingEntity <Dictionary <string, object> >( "OrderGood", j => j .HasOne <Good>() .WithMany() .HasForeignKey("GoodId") .HasConstraintName("FK_OrderGood_Goods_GoodId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(false), j => j .HasOne <Order>() .WithMany() .HasForeignKey("OrderId") .HasConstraintName("FK_OrderGood_Orders_OrderId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(false) ); // modelBuilder.Entity<Order>() // .HasOne<User>() // .WithMany() // .HasForeignKey(e => e.UserId); #endregion #region UserConfig #endregion #region FakerConfig FakeDataGenerator.Init(10); modelBuilder.Entity <User>().HasData(FakeDataGenerator.Users); modelBuilder.Entity <Store>().HasData(FakeDataGenerator.Stores); modelBuilder.Entity <Managers>().HasData(FakeDataGenerator.Managers); modelBuilder.Entity <Message>().HasData(FakeDataGenerator.Messages); modelBuilder.Entity <Category>().HasData(FakeDataGenerator.Categories); modelBuilder.Entity <Good>().HasData(FakeDataGenerator.Goods); #endregion }
public Estabelecimento InsereEmpresaComEstabelecimentoMatriz(Empresa EmpresaStep, EstabelecimentoParametro EstabelecimentoParametroMatrizStep) { string idGeneral = Guid.NewGuid().ToString(); Empresa Empresa = new Empresa(); Estabelecimento EstabelecimentoMatriz = new Estabelecimento(); EnderecoEstabelecimento enderecoEstabelecimento = new EnderecoEstabelecimento(); Empresa.Id = idGeneral; Empresa.nrInsc = FakeDataGenerator.FakeCnpj().Replace(".", "").Replace("/", "").Replace("-", ""); Empresa.idCnae = "13B1619D-EE89-4BA3-A03A-7E392F037B19"; Empresa.nmRazao = FakeDataGenerator.FakeNomeDaEmpresa(); Empresa.idSituacaoPessoaJuridica = "724BFCEB-8C86-4C3E-B88D-1951A88C2D8C"; Empresa.idClassificacaoTributaria = EmpresaStep.idClassificacaoTributaria ?? "85C0C70C-C870-4193-858C-3513AEDC657D"; Empresa.idAtividadeSimplesNacional = EmpresaStep.idAtividadeSimplesNacional ?? null; Empresa.idCooperativa = "263C627C-4D09-49C7-BBB3-1CADD34FA800"; Empresa.idContrato = "BF6513E0-7CAC-4CED-B05C-347198285EF0"; Empresa.idNaturezaJuridica = "70373266-1BB1-49EE-BEE6-0B1405016215"; Empresa.tpInsc = "1"; Empresa.status = "A"; Empresa.indConstr = "1"; Empresa.indOpcCP = null; Empresa = JsonConvert.DeserializeObject <Empresa>(Services.POST(ServiceConfig.GetUrlAdm() + "/hypercube_adm/v1/empresa", JsonConvert.SerializeObject(Empresa))); EstabelecimentoMatriz.id = idGeneral; EstabelecimentoMatriz.idEmpresa = Empresa.Id; EstabelecimentoMatriz.tpEstabelecimento = 1; EstabelecimentoMatriz.tpInsc = 1; EstabelecimentoMatriz.telefone = "19994198982"; EstabelecimentoMatriz.nrInsc = FakeDataGenerator.FakeCnpj().Replace(".", "").Replace("/", "").Replace("-", ""); EstabelecimentoMatriz.nmRazao = FakeDataGenerator.FakeNomeDaEmpresa(); EstabelecimentoMatriz.idCnae = "13B1619D-EE89-4BA3-A03A-7E392F037B19"; EstabelecimentoMatriz.idRegistroPonto = "733D9D22-E3C8-4321-8A3A-5AC56F9E1B46"; EstabelecimentoMatriz.status = "A"; enderecoEstabelecimento.id = idGeneral; enderecoEstabelecimento.idEstabelecimento = idGeneral; enderecoEstabelecimento.tpEndereco = 1; enderecoEstabelecimento.tpLograd = "0"; enderecoEstabelecimento.dscLograd = "Avenida Marcello Braguini"; enderecoEstabelecimento.nrLograd = "1234"; enderecoEstabelecimento.bairro = "Jardim Arangá"; enderecoEstabelecimento.codMunic = "1"; enderecoEstabelecimento.nmMunic = "Araraquara"; enderecoEstabelecimento.uf = "SP"; enderecoEstabelecimento.cep = "13466200"; EstabelecimentoMatriz.enderecoEstabelecimentoReference = enderecoEstabelecimento; EstabelecimentoMatriz = JsonConvert.DeserializeObject <Estabelecimento>(Services.POST(ServiceConfig.GetUrlAdm() + "/hypercube_adm/v1/estabelecimento", JsonConvert.SerializeObject(EstabelecimentoMatriz))); EstabelecimentoParametroPeriodo EstabelecimentoParametroPeriodoMatriz = new EstabelecimentoParametroPeriodo(); EstabelecimentoParametroPeriodoMatriz.id = idGeneral; EstabelecimentoParametroPeriodoMatriz.idEstabelecimento = EstabelecimentoMatriz.id; EstabelecimentoParametroPeriodoMatriz.subscriptionId = EstabelecimentoMatriz.subscriptionId; EstabelecimentoParametroPeriodoMatriz.inicioPeriodo = "2019-01-01"; EstabelecimentoParametroPeriodoMatriz.fimPeriodo = "2099-12-31"; EstabelecimentoParametroPeriodoMatriz.codigoTerceiros = "0115"; EstabelecimentoParametroPeriodoMatriz.inicioPeriodoAnoMes = "01/2019"; EstabelecimentoParametroPeriodoMatriz.fimPeriodoAnoMes = "12/2099"; EstabelecimentoParametroPeriodoMatriz.aliquotaFap = "1.0000"; EstabelecimentoParametroPeriodoMatriz.aliquotaRat = "5.00"; EstabelecimentoParametroPeriodoMatriz.aliquotaInssPatronal = "20.00"; EstabelecimentoParametroPeriodoMatriz.idFundoPrevidenciaAssistenciaSocial = "62FD451E-5013-4A5E-AE28-831C5C65FB18"; EstabelecimentoParametroPeriodoMatriz.idReceitaContribuicaoPrevidenciaria = "91A1DCD3-A975-4B79-9617-B1EEA5F9EE5C"; EstabelecimentoParametroPeriodoMatriz.aliquotaInssTerceiros = "2.70"; EstabelecimentoParametroPeriodoMatriz.nomeContato = "Default"; EstabelecimentoParametroPeriodoMatriz.responsavelTransmissao = "Empresa"; Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/estabelecimentoparametroperiodo", JsonConvert.SerializeObject(EstabelecimentoParametroPeriodoMatriz)); EstabelecimentoParametro EstabelecimentoParametroMatriz = new EstabelecimentoParametro(); EstabelecimentoParametroMatriz.id = idGeneral; EstabelecimentoParametroMatriz.idEstabelecimento = EstabelecimentoMatriz.id; EstabelecimentoParametroMatriz.pagamentoMensalDia = EstabelecimentoParametroMatrizStep.pagamentoMensalDia ?? "28"; EstabelecimentoParametroMatriz.pagamentoMensalDiaNaoUtil = EstabelecimentoParametroMatrizStep.pagamentoMensalDiaNaoUtil ?? "Nenhum"; EstabelecimentoParametroMatriz.adiantamentoMensalHabilitado = EstabelecimentoParametroMatrizStep.adiantamentoMensalHabilitado; EstabelecimentoParametroMatriz.adiantamentoMensalDiaNaoUtil = EstabelecimentoParametroMatrizStep.adiantamentoMensalDiaNaoUtil ?? "Nenhum"; EstabelecimentoParametroMatriz.adiantamentoMensalDia = EstabelecimentoParametroMatrizStep.adiantamentoMensalDia ?? "15"; EstabelecimentoParametroMatriz.adiantamentoMensalPercentual = EstabelecimentoParametroMatrizStep.adiantamentoMensalPercentual ?? "40.00"; EstabelecimentoParametroMatriz.adiantamentoMesAdmissao = EstabelecimentoParametroMatrizStep.adiantamentoMesAdmissao; EstabelecimentoParametroMatriz.adiantamentoMesAdmissaoProporcional = EstabelecimentoParametroMatrizStep.adiantamentoMesAdmissaoProporcional; EstabelecimentoParametroMatriz.subscriptionId = EstabelecimentoMatriz.subscriptionId; EstabelecimentoParametroMatriz.idRegistroPonto = "CA09D73B-4028-4F93-BD0B-C20639EDB8B4"; Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/estabelecimentoparametro", JsonConvert.SerializeObject(EstabelecimentoParametroMatriz)); return(EstabelecimentoMatriz); }
public HomeViewModel Index() { return(new HomeViewModel { Questions = FakeDataGenerator.CreateFakeQuestions() }); }
public TransactionsControllerTest() { fakeDataGenerator = new FakeDataGenerator(_businessLogicService); }
public Trabalhador InsereTrabalhadorComOContratoParaOEstabelecimento(Estabelecimento estabelecimento, ContratoTrabalho ContratoTrabalhoStep, ContratoTrabalhoHistorico ContratoTrabalhoHistoricoStep) { Cargo Cargo = CargoServiceSteps.OCadastroRapidoDoCargo(); Setor Setor = DepartamentoServiceSteps.OCadastroRapidoDoDepartamentoComSetorESecao(estabelecimento.idEmpresa); Secao Secao = SecaoService.InsereSecaoPorIdDoSetor(Setor.id); string idGeneral = Guid.NewGuid().ToString(); Trabalhador Trabalhador = new Trabalhador(); EnderecoTrabalhador TrabalhadorEndereco = new EnderecoTrabalhador(); ContatoTrabalhador TrabalhadorContato = new ContatoTrabalhador(); ContratoTrabalho ContratoTrabalho = new ContratoTrabalho(); ContratoTrabalhoHistorico ContratoTrabalhoHistorico = new ContratoTrabalhoHistorico(); Trabalhador.id = idGeneral; Trabalhador.nome = FakeDataGenerator.FakeNomeCompleto(); Trabalhador.cpf = FakeDataGenerator.FakeCpf(); Trabalhador.nis = FakeDataGenerator.FakeNis(); Trabalhador.status = "A"; Trabalhador.dataNascimento = "1988-02-19 03:00:00.0000000"; Trabalhador.idEstadoCivil = "CAC9D956-8CD5-4FB9-B87B-9EB8F683E49A"; Trabalhador.idGenero = "3C384655-1F59-4CBA-9BDF-9C915673BD7D"; Trabalhador.idGrauInstrucao = "29003908-FF64-4B54-899A-080A398FA634"; Trabalhador.idNacionalidade = "A91D4871-01DE-4996-BAF4-8B67E0ECA0B5"; Trabalhador.idRaca = "EB86CB87-52D5-472A-93F5-F7D2CEA83089"; TrabalhadorEndereco.id = idGeneral; TrabalhadorEndereco.idTrabalhador = Trabalhador.id; TrabalhadorEndereco.numero = "123"; TrabalhadorEndereco.logradouro = "Av. Marcello Braquini"; TrabalhadorEndereco.complemento = ""; TrabalhadorEndereco.municipio = "Araraquara"; TrabalhadorEndereco.codigoMunicipio = "3503208"; TrabalhadorEndereco.bairro = "Jardim Arangá"; TrabalhadorEndereco.uf = "SP"; TrabalhadorEndereco.cep = "14807092"; TrabalhadorContato.id = idGeneral; TrabalhadorContato.idTrabalhador = Trabalhador.id; TrabalhadorContato.email = "*****@*****.**"; TrabalhadorContato.telefone = "95983520367"; Trabalhador.enderecoTrabalhadorReference = TrabalhadorEndereco; Trabalhador.contatoTrabalhadorReference = TrabalhadorContato; Trabalhador = JsonConvert.DeserializeObject <Trabalhador>(Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/trabalhador", JsonConvert.SerializeObject(Trabalhador))); //DocumentoTrabalhador DocumentoTrabalhador documentoTrabalhadorCarteiraTrabalho = new DocumentoTrabalhador(); Documento doc1 = new Documento(); Documento doc2 = new Documento(); Documento doc3 = new Documento(); List <Documento> listaDocumentosCarteiraTrabalho = new List <Documento>(); documentoTrabalhadorCarteiraTrabalho.idTrabalhador = Trabalhador.id; documentoTrabalhadorCarteiraTrabalho.idTipoDocumento = "75F5E19B-35CD-4864-AA2B-FDFEC59EC849"; doc1.chave = "uf"; doc1.valor = "PR"; listaDocumentosCarteiraTrabalho.Add(doc1); doc2.chave = "serie"; doc2.valor = "1111-1"; listaDocumentosCarteiraTrabalho.Add(doc2); doc3.chave = "numero"; doc3.valor = "11111111111"; listaDocumentosCarteiraTrabalho.Add(doc3); documentoTrabalhadorCarteiraTrabalho.documento = listaDocumentosCarteiraTrabalho.ToArray(); Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/documentotrabalhador", JsonConvert.SerializeObject(documentoTrabalhadorCarteiraTrabalho)); DocumentoTrabalhador documentoTrabalhadorRg = new DocumentoTrabalhador(); Documento doc4 = new Documento(); Documento doc5 = new Documento(); Documento doc6 = new Documento(); Documento doc7 = new Documento(); List <Documento> listaDocumentosRg = new List <Documento>(); documentoTrabalhadorRg.idTrabalhador = Trabalhador.id; documentoTrabalhadorRg.idTipoDocumento = "BADE9CEB-DA90-4077-BB72-32DCF5C1751F"; doc4.chave = "dataExpedicao"; doc4.valor = "1997-10-15T02:00:00.000Z"; listaDocumentosRg.Add(doc4); doc5.chave = "orgaoEmissor"; doc5.valor = "fae242fb-932d-4d58-8b70-73c05685dc6d"; listaDocumentosRg.Add(doc5); doc6.chave = "numero"; doc6.valor = FakeDataGenerator.FakeRg().Replace("-", "").Replace(".", ""); listaDocumentosRg.Add(doc6); doc7.chave = "uf"; doc7.valor = "BA"; listaDocumentosRg.Add(doc7); documentoTrabalhadorRg.documento = listaDocumentosRg.ToArray(); Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/documentotrabalhador", JsonConvert.SerializeObject(documentoTrabalhadorRg)); ContratoTrabalho.id = idGeneral; ContratoTrabalho.idEmpresa = estabelecimento.idEmpresa; ContratoTrabalho.idEstabelecimento = estabelecimento.id; ContratoTrabalho.idTrabalhador = Trabalhador.id; ContratoTrabalho.dataInicio = ContratoTrabalhoStep.dataInicio ?? "2019-01-01 03:00:00.0000000"; ContratoTrabalho.idTipoSalario = ContratoTrabalhoStep.idTipoSalario ?? "9CABD094-62EF-4651-AEC7-7AEB60DC2FFC"; ContratoTrabalho.matricula = FakeDataGenerator.FakeMatricula(); ContratoTrabalho.possuiAdiantamento = ContratoTrabalhoStep.possuiAdiantamento; ContratoTrabalho = JsonConvert.DeserializeObject <ContratoTrabalho>(Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/contratotrabalho/", JsonConvert.SerializeObject(ContratoTrabalho))); ContratoTrabalhoHistorico.id = idGeneral; ContratoTrabalhoHistorico.idContratoTrabalho = ContratoTrabalho.id; ContratoTrabalhoHistorico.idCargo = Cargo.id; ContratoTrabalhoHistorico.idDepartamento = Setor.DepartamentoReference.id; ContratoTrabalhoHistorico.idSetor = Setor.id; ContratoTrabalhoHistorico.idSecao = Secao.id; ContratoTrabalhoHistorico.idCategoriaTrabalhador = ContratoTrabalhoHistoricoStep.idCategoriaTrabalhador ?? "BB187274-AC86-49A2-BAC3-170ABC33DC2A"; ContratoTrabalhoHistorico.inicioVigencia = "2019-01-01"; ContratoTrabalhoHistorico.fimVigencia = "3000-01-31"; ContratoTrabalhoHistorico.salario = "2456.99"; ContratoTrabalhoHistorico.horasMensais = "220.00"; Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/contratotrabalhohistorico", JsonConvert.SerializeObject(ContratoTrabalhoHistorico)); Trabalhador.status = "A"; Services.PUT(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/trabalhador/" + Trabalhador.id, JsonConvert.SerializeObject(Trabalhador)); return(Trabalhador); }
public static async Task InitStore(MobileServiceClient client) { try { if (_databaseInitialized) { return; } var store = new MobileServiceSQLiteStore(Constants.DbFileName); store.DefineTable <UserAccount>(); //INIT all data tables here //Initializes the SyncContext using the default IMobileServiceSyncHandler. var initializeAsync = SharedClient.CurrentClient?.SyncContext.InitializeAsync(store); if (initializeAsync != null) { try { await initializeAsync; } catch (Exception e) { Console.WriteLine(e); throw; } } #if FAKEDATA if (Settings.FirstRun) { //Pre-fill tables //wishes var wishesList = new List <Wish>(FakeDataGenerator.GetWishes()); var wishesRepository = App.DryIocContainer.Resolve <IWishesRepository>(); foreach (var wish in wishesList) { await wishesRepository.CreateWishAsync(wish); } //if (!Settings.InitialWizardRequired) //{ ///else we would never get the accounts list there var accountsSms = FakeDataGenerator.GetAccountsRepositorySms().ToList(); var bankAccountsSmsRepository = App.DryIocContainer.Resolve <IBankAccountsSmsRepository>(); foreach (var accountSms in accountsSms) { await bankAccountsSmsRepository.CreateAccountAsync(accountSms); } // } var accountsApi = FakeDataGenerator.GetAccountsApiRepository1().ToList(); var bankAccountsApi = App.DryIocContainer.Resolve <IBankAccountsApiRepository>(); foreach (var accountApi in accountsApi) { await bankAccountsApi.CreateAccountAsync(accountApi); } var banks = FakeDataGenerator.GetDescriptorApiRepositorySms().ToList(); var bankAccountsSmsDescriptors = App.DryIocContainer.Resolve <IBankAccountDescriptorSmsRepository>(); foreach (var accountDescriptorSms in banks) { await bankAccountsSmsDescriptors.CreateAccountDescriptorAsync(accountDescriptorSms); } var banksApi = FakeDataGenerator.GetDescriptorApiRepositoryApi().ToList(); var bankAccountsApiDescriptors = App.DryIocContainer.Resolve <IBankAccountDescriptorApiRepository>(); foreach (var accountDescriptorApi in banksApi) { await bankAccountsApiDescriptors.CreateAccountDescriptorAsync(accountDescriptorApi); } var regularPaymentTemplates = FakeDataGenerator.GetRegularPaymentTemplates().ToList(); var regularPaymentTemplatesRepository = App.DryIocContainer.Resolve <IRegularPaymentTemplatesRepository>(); foreach (var regularPaymentTemplate in regularPaymentTemplates) { await regularPaymentTemplatesRepository.CreateRegularPaymentTemplateAsync( regularPaymentTemplate); } var regularPayments = FakeDataGenerator.GetRegularPayments().ToList(); var regularPaymentsRepository = App.DryIocContainer.Resolve <IRegularPaymentsRepository>(); foreach (var regularPaymentTemplate in regularPayments) { await regularPaymentsRepository.CreateRegularPaymentAsync( regularPaymentTemplate); } var bankTemplates = FakeDataGenerator.GetBankTemplates().ToList(); var bankTemplatesRepository = App.DryIocContainer.Resolve <IBankTemplateRepository>(); foreach (var templateBank in bankTemplates) { await bankTemplatesRepository.CreateTemplateAsync(templateBank); } var regularPaymentsPaid = FakeDataGenerator.GetRegularPaymentsPaid().ToList(); var regularPaymentsPaidRepository = App.DryIocContainer.Resolve <IRegularPaymentsPaidRepository>(); foreach (var regularPaymentPaid in regularPaymentsPaid) { await regularPaymentsPaidRepository.CreateRegularPaymentPaidAsync(regularPaymentPaid); } } #endif if (Settings.FirstRun) { //Pre-fill tables } Settings.FirstRun = false; _databaseInitialized = true; } catch (Exception e) { Console.WriteLine(e); throw; } }