Exemplo n.º 1
0
        public void A_ChangedDevice_modifies_Existing_country_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();

            //2.- Create the tuple in the database
            var repository = new MediaRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //3.- Change the aggregate
            aggr.SapCode = StringExtension.RandomString(10);
            aggr.MediaMachine.ToList().ForEach(m => m.TimeStamp = DateTimeOffset.Now);
            aggr.MediaServiceLevel.ToList().ForEach(m => m.TimeStamp = DateTimeOffset.Now);
            aggr.MediaDeviceGroup.ToList().ForEach(m => m.Deleted = new Random().Next());

            //4.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(ChangedMedia).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });

            //5.- Load the saved country
            var service = repository.Get(aggr.Id);
            //6.- Check equality
            Assert.True(ObjectExtension.AreEqual(aggr, service));
        }
Exemplo n.º 2
0
 public ViewModelLocator()
 {
     if (bootStrapper == null)
     {
         bootStrapper = new BootStrapper();
     }
 }
        public void A_ChangedGateway_modifies_Existing_Gateway_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();

            //2.- Create the tuple in the database
            var repository = new PaymentGatewayRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //3.- Change the aggregate
            aggr.GatewayDescription = StringExtension.RandomString(20);
            aggr.GatewayByCountry.ToList().ForEach(e => e.CountryId = Guid.NewGuid());

            //4.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(ChangedPaymentGateway).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });

            //5.- Load the saved country
            var gateway = repository.Get(aggr.Id);
            //6.- Check equality
            Assert.True(ObjectExtension.AreEqual(aggr, gateway));
        }
Exemplo n.º 4
0
        public void A_ChangedTax_modifies_Existing_country_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();

            //2.- Create the tuple in the database
            var repository = new TaxRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //3.- Change the aggregate
            aggr.NameKeyId = StringExtension.RandomString(10);
            aggr.CountryId = Guid.NewGuid();
            aggr.SapCode = StringExtension.RandomString(2);
            aggr.CurrencyId = Guid.NewGuid();
            aggr.BaseAmount = decimal.Round(Convert.ToDecimal(new Random().NextDouble()), 2 , MidpointRounding.AwayFromZero);
            aggr.Amount = decimal.Round(Convert.ToDecimal(new Random().NextDouble()), 2, MidpointRounding.AwayFromZero);

            //4.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(ChangedTax).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });


            //5.- Load the saved country
            var tax = repository.Get(aggr.Id);
            //6.- Check equality
            Assert.True(ObjectExtension.AreEqual(aggr, tax));
        }
Exemplo n.º 5
0
        public void A_ChangedPatient_modifies_Existing_Patient_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();

            //2.- Create the tuple in the database
            var repository = new PatientRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //3.- Change the aggregate
            aggr.SapCode = StringExtension.RandomString();
            aggr.Person.Phone1 = StringExtension.RandomString(3);
            aggr.Person.PersonLocation.First().LocationId = Guid.NewGuid();
            aggr.User.RegistrationCode = StringExtension.RandomString(5);

            //4.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(ChangedPatient).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });

            //5.- Load the saved country
            var service = repository.Get(aggr.Id);
            //6.- Check equality
            Assert.True(ObjectExtension.AreEqual(aggr, service));
        }
Exemplo n.º 6
0
        public void A_ChangedAnswer_modifies_Existing_Answer_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();

            //2.- Create the tuple in the database
            var repository = new AnswerRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //3.- Change the aggregate
            aggr.PersonId = Guid.NewGuid();
            aggr.AnswerValues.ToList().ForEach(v => v.Type = new Random().Next());

            //4.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(ChangedAnswer).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });

            //5.- Load the saved country
            var country = repository.Get(aggr.Id);
            //6.- Check equality
            Assert.True(ObjectExtension.AreEqual(aggr, country));
            
        }
Exemplo n.º 7
0
 static void Main(string[] args)
 {
     XmlConfigurator.Configure();
     var bootStrapper = new BootStrapper();
     var application = bootStrapper.GetApplciation();
     application.RunFromConfig();
 }
Exemplo n.º 8
0
        public void A_ChangedMachine_modifies_Existing_Machine_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();

            //2.- Create the tuple in the database
            var repository = new MachineRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //3.- Change the aggregate
            aggr.DescriptionKeyId = StringExtension.RandomString(10);
            aggr.MachineGroup.SapCode = StringExtension.RandomString(10);
            aggr.MachinePrinter.First().Function = new Random().Next();

            //4.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(ChangedMachine).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });

            //5.- Load the saved country
            var service = repository.Get(aggr.Id);
            //6.- Check equality
            Assert.True(ObjectExtension.AreEqual(aggr, service));
        }
Exemplo n.º 9
0
        public void A_ChangedFreeSessionReason_modifies_Existing_country_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();

            //2.- Create the tuple in the database
            var repository = new RegionRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //3.- Change the aggregate
            aggr.NameKeyId = StringExtension.RandomString(10);
            aggr.CountryId = Guid.NewGuid();
            aggr.SapCode = StringExtension.RandomString(2);

            //4.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(ChangedRegion).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });

            //5.- Load the saved country
            var region = repository.Get(aggr.Id);
            //6.- Check equality
            Assert.True(ObjectExtension.AreEqual(aggr, region));
        }
Exemplo n.º 10
0
 static void Main(string[] args)
 {
     var bootstrapper = new BootStrapper();
     bootstrapper.StartServices();
     bootstrapper.StartKafkaListener();
     bootstrapper.StartLogger();
     while (true);
 }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            BootStrapper bootStrapper = new BootStrapper();

            IGameUI gameUI = bootStrapper.NewGameUI();

            gameUI.PlayGame();
        }
Exemplo n.º 12
0
 public void A_RegisteredMedia_creates_a_new_media_in_the_database()
 {
     var bootStrapper = new BootStrapper();
     bootStrapper.StartServices();
     var serviceEvents = bootStrapper.GetService<IServiceEvents>();
     //1.- Create message
     var aggr = GenerateRandomAggregate();
     var message = GenerateMessage(aggr);
     //2.- Emit message
     serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });
     //3.- Load the saved country
     var repository = new MediaRepository(_configuration.TestServer);
     var service = repository.Get(aggr.Id);
     //4.- Check equality
     Assert.True(ObjectExtension.AreEqual(aggr, service));
 }
Exemplo n.º 13
0
        public void A_UnregisteredDevice_modifies_Existing_country_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();

            //2.- Create the tuple in the database
            var repository = new MediaRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //2.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(UnregisteredMedia).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });

            var service = repository.Get(aggr.Id);
            Assert.Null(service);
        }
Exemplo n.º 14
0
 //[Fact]
 public void A_RegisteredAuditLogon_creates_a_new_currency_in_the_database()
 {
     var bootStrapper = new BootStrapper();
     bootStrapper.StartServices();
     var serviceEvents = bootStrapper.GetService<IServiceEvents>();
     //1.- Create message
     var aggr = GenerateRandomAggregate();
     var message = GenerateMessage(aggr);
     //2.- Emit message
     serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });
     //3.- Load the saved country
     var repository = new AuditLogonRepository(_configuration.TestServer);
     var title = repository.Get(aggr.Id);
     //4.- Check equality
     Assert.Equal(aggr.Id, title.Id);
     Assert.Equal(aggr.UserName, title.UserName);
     Assert.Equal(aggr.Ip, title.Ip);
     Assert.Equal(aggr.Access, title.Access);
     Assert.Equal(aggr.AccessDate, title.AccessDate);
     Assert.Equal(aggr.PartnerId, title.PartnerId);
     Assert.Equal(aggr.TimeStamp.Second, title.TimeStamp.Second);
 }
Exemplo n.º 15
0
        public void A_ChangedPayable_modifies_Existing_Payable_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();

            //2.- Create the tuple in the database
            var repository = new PayableRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //3.- Change the aggregate
            aggr.CurrencyId = Guid.NewGuid();
            aggr.PaymentTransaction.ToList().ForEach(t =>
                {
                    t.PartnerId = Guid.NewGuid();
                    t.Payment.PaymentType = new Random().Next();
                    t.Payment.PaymentMpos.OperationNumber = StringExtension.RandomString(5);
                    t.PaymentTaxTransaction.ToList().ForEach(tt =>
                        {
                            tt.TaxId = Guid.NewGuid();
                        });
                });

            //4.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(ChangedPayable).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });

            //5.- Load the saved country
            var country = repository.Get(aggr.Id);
            //6.- Check equality
            Assert.True(ObjectExtension.AreEqual(aggr, country));
            
        }
Exemplo n.º 16
0
 static async Task Main(string[] args)
 => await BootStrapper.Run <Empty>(args);
 private static void InitializeContainer(Container container)
 {
     BootStrapper.Initialize(container, Lifestyle.Scoped);
 }
Exemplo n.º 18
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddMvc(options =>
            {
                options.Filters.Add(typeof(HttpGlobalExceptionFilter));
                options.Filters.Add(typeof(ValidateModelStateFilter));
            }
                            ).AddControllersAsServices().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            services.Configure <BluePrint>(Configuration.GetSection("Settings"));
            services.Configure <BluePrint>(Configuration.GetSection("Features"));
            services.AddSingleton <IConfiguration>(Configuration);
            ConfigureAuthService(services);

            services.AddHealthChecks();


            BusBootStrapper.RegisterEventBus(services, Configuration);
            BootStrapper.RegisterComponents(services, Configuration);

            services.AddSwaggerGen(options =>
            {
                options.DescribeAllEnumsAsStrings();
                options.SwaggerDoc("v1", new Info
                {
                    Title          = "Manager HTTP API",
                    Version        = "v1",
                    Description    = "The Manager Service HTTP API",
                    TermsOfService = "Terms Of Service"
                });

                options.AddSecurityDefinition("oauth2", new OAuth2Scheme
                {
                    Type             = "oauth2",
                    Flow             = "implicit",
                    AuthorizationUrl = $"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize",
                    TokenUrl         = $"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/token",
                    Scopes           = new Dictionary <string, string>()
                    {
                        { "manager", "Manager API" }
                    }
                });

                options.OperationFilter <AuthorizeCheckOperationFilter>();
            });

            services.AddCors(options =>
            {
                options.AddPolicy("CorsPolicy",
                                  builder => builder.AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader()
                                  .AllowCredentials());
            });
            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddTransient <IJobRepository, JobRepository>();
            services.AddTransient <IIdentityService, IdentityService>();

            services.AddOptions();

            var container = new ContainerBuilder();

            container.Populate(services);

            return(new  AutofacServiceProvider(container.Build()));
        }
Exemplo n.º 19
0
 private static void InitializeContainer(Container container)
 {
     BootStrapper.RegisterServices(container);
 }
Exemplo n.º 20
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var type = parameter as Type ?? throw new ArgumentNullException(nameof(parameter));

            return(BootStrapper.GetService(type));
        }
Exemplo n.º 21
0
 public ViewModelLocator()
 {
     _container = BootStrapper.BootStrap();
 }
Exemplo n.º 22
0
        public void TestB2B()
        {
            BootStrapper.Boot();
            AuthManager.SaveUser(new BPiaoBao.SystemSetting.Domain.Services.Auth.CurrentUserInfo()
            {
                Code            = "w0001",
                BusinessmanName = "成都高新环球"
            });

            //IStationOrderService orderService = ObjectFactory.GetInstance<IStationOrderService>();
            //orderService.AddCoordinationDto("05402303911461036293", "121", "jkjkjkjj", false);

            //04750648053131210303

            //string strDetr = "";
            //string err = "";
            //PnrAnalysis.FormatPNR format = new PnrAnalysis.FormatPNR();
            ////string Pnr = format.GetPNR(strDetr, out err);
            ////TicketInfo ticketInfo = format.GetDetr(strDetr);
            //TicketInfo ticketInfo = format.GetDetrS(strDetr);


            //return;
            //IPidService PidService = ObjectFactory.GetInstance<PidService>();
            //bool ss = PidService.CancelPnr("5110270803", "CTU186", "HFT4P4");


            //QueryFlightService queryFlightService = new BPiaoBao.DomesticTicket.Domain.Services.QueryFlightService();
            //CabinData cabinData = queryFlightService.GetBaseCabinUsePolicy("MU");
            //List<string> aa = new List<string>();
            //List<CabinRow> list = cabinData.CabinList;
            //foreach (CabinRow item in list)
            //{
            //    if (!aa.Contains(item.Seat))
            //    {
            //        aa.Add(item.Seat);
            //    }
            //}

            //int nnn = aa.Count;
            //int mmm = list.Count;


            // CabinRow[] CabinRow = list.Union(list);

            //WebHttp http = new WebHttp();
            //string url = "";
            //DataResponse response = http.SendRequest(url, MethodType.GET, Encoding.Default, 60);
            //string strdata = response.Data;

            //TravelPaperService travelPaperService = ObjectFactory.GetInstance<TravelPaperService>();
            //travelPaperService.AddTravelPaper("test01", "000000001", "000000010", "CTU186", "123456", "测试公司", "11");


            //IBusinessmanRepository BusinessmanRepository = ObjectFactory.GetInstance<IBusinessmanRepository>();
            //IPidService IPidService = ObjectFactory.GetInstance<IPidService>();
            //FlightDestineService flightDestineService = new FlightDestineService(BusinessmanRepository, IPidService);
            //flightDestineService.GetLegStop("test01", "EU2241", DateTime.Parse("2014-07-30"));


            ////return;

            //DomesticService domesticService = ObjectFactory.GetInstance<DomesticService>();
            //domesticService.AutoIssue("04979657898018392247", "测试");
            //Console.ReadLine();
            //AutoTicketService b2bTest = new AutoTicketService();
            //AutoEtdzParam autoEtdzParam = new AutoEtdzParam();
            //autoEtdzParam.IsLimitScope = true;
            ////autoEtdzParam.IsMulPrice = false;
            //autoEtdzParam.OldPolicyPoint = 2.8m;
            //autoEtdzParam.Pnr = "HV7SEK";
            //autoEtdzParam.BigPnr = "NZCLCM ";
            //autoEtdzParam.CarryCode = "HU";
            //autoEtdzParam.FlatformOrderId = "";
            //autoEtdzParam.PayInfo.PayAccount = "*****@*****.**";
            //autoEtdzParam.B2BAccount = "urc221";
            //autoEtdzParam.B2BPwd = "xdt08049440";
            //autoEtdzParam.PayInfo.PayTotalPrice = 1320;
            //autoEtdzParam.PayInfo.SeatTotalPrice = 98;
            //autoEtdzParam.PayInfo.TaxTotalPrice = 340;
            //autoEtdzParam.UrlInfo.AlipayAutoCPUrl = "http://210.14.138.26:6350/alidz.do";
            //autoEtdzParam.UrlInfo.AlipayTicketNotifyUrl = "http://210.14.138.26:91/Pay/PTReturnPage/AliPayNotifyUrl.aspx";
            //autoEtdzParam.UrlInfo.AlipayPayNotifyUrl = "http://210.14.138.26:91/Pay/PTReturnPage/AliPayNotifyUrl.aspx";
            //autoEtdzParam.UseAutoType = 0;

            //B2BResponse b2bResponse = new B2BResponse();
            //b2bResponse = b2bTest.NewQueryOrder(autoEtdzParam);
            //b2bResponse = b2bTest.NewQueryPriceByPnr(autoEtdzParam, QueryPolicyType.all);

            string strUrl = "http://210.14.138.26:6350/alidz.do";
            //bool IsRun = b2bTest.checkclt(strUrl);

            string xml = "";
            // b2bResponse = b2bTest.SyncNotifyXmlToModel(xml);

            //b2bResponse = b2bTest.SyncPayCall(xml);
            //b2bResponse = b2bTest.TicketOut(autoEtdzParam);
        }
Exemplo n.º 23
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            var basePath = PlatformServices.Default.Application.ApplicationBasePath;
            var xmlPath  = Path.Combine(basePath, string.Format("{0}.xml", projectName));

            // Añadimos Swagger
            services.AddSwaggerGen(x =>
            {
                x.SwaggerDoc(name: "v1", new Microsoft.OpenApi.Models.OpenApiInfo
                {
                    Title   = Configuration["Swagger:Title"],
                    Version = "v1",
                    Contact = new Microsoft.OpenApi.Models.OpenApiContact()
                    {
                        Name  = "INSTITUTO TECNOLÓGICO DE INFORMÁTICA (ITI)",
                        Email = "*****@*****.**",
                        Url   = new Uri("https://www.iti.es/")
                    }
                });

                x.AddSecurityDefinition("Bearer",
                                        new OpenApiSecurityScheme
                {
                    Description = "JWT Authorization header using the Bearer scheme.",
                    Type        = SecuritySchemeType.Http,
                    Scheme      = "bearer"
                });

                x.AddSecurityRequirement(new OpenApiSecurityRequirement {
                    {
                        new OpenApiSecurityScheme {
                            Reference = new OpenApiReference {
                                Id   = "Bearer",
                                Type = ReferenceType.SecurityScheme
                            }
                        }, new List <string>()
                    }
                });

                x.IncludeXmlComments(xmlPath);
            });

            //Añadimos CORS
            services.AddCors(options =>
            {
                options.AddPolicy("AllowAll",
                                  builder =>
                {
                    builder
                    .AllowAnyOrigin()
                    .AllowAnyMethod()
                    .AllowAnyHeader()
                    .WithExposedHeaders("Content-Disposition");
                });
            });

            //Configuramos Autenticación por TOKEN JWT.

            services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = new TokenValidationParameters
                {
                    ValidateIssuer           = true,
                    ValidateAudience         = true,
                    ValidateLifetime         = true,
                    ValidateIssuerSigningKey = true,
                    ValidIssuer      = Configuration["Jwt:Issuer"],
                    ValidAudience    = Configuration["Jwt:Issuer"],
                    IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["Jwt:Key"]))
                };

                options.Events = new JwtBearerEvents
                {
                    OnMessageReceived = context =>
                    {
                        var accessToken = context.Request.Query["access_token"];

                        // If the request is for our hub...
                        var path = context.HttpContext.Request.Path;
                        if (!string.IsNullOrEmpty(accessToken) &&
                            (path.StartsWithSegments("/userChannelHub")))
                        {
                            // Read the token out of the query string
                            context.Token = accessToken;
                        }
                        return(Task.CompletedTask);
                    }
                };
            });

            //Configuramos EntityFramework

            services.AddDbContext <DbContextProyecto>(options => options
                                                      .UseLazyLoadingProxies()
                                                      .UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            services.AddLocalization();

            services.AddOData();

            services.AddMvc(options =>
            {
                options.Filters.Add(typeof(ValidateModelStateAttribute));

                var policy = new AuthorizationPolicyBuilder()
                             .RequireAuthenticatedUser()
                             .Build();

                options.Filters.Add(new AuthorizeFilter(policy));

                options.EnableEndpointRouting = false;

                foreach (var outputFormatter in options.OutputFormatters.OfType <ODataOutputFormatter>().Where(_ => _.SupportedMediaTypes.Count == 0))
                {
                    outputFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/prs.odatatestxx-odata"));
                }
                foreach (var inputFormatter in options.InputFormatters.OfType <ODataInputFormatter>().Where(_ => _.SupportedMediaTypes.Count == 0))
                {
                    inputFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/prs.odatatestxx-odata"));
                }
            });

            //Añadimos SignalR
            services.AddSignalR().AddJsonProtocol(options => { options.PayloadSerializerOptions.PropertyNamingPolicy = null; });

            services.AddAuthorization(options =>
            {
                options.DefaultPolicy = new AuthorizationPolicyBuilder()
                                        .RequireAuthenticatedUser()
                                        .Build();
            });

            //Añadimos los componentes de ITI.Core
            BootStrapper bootStrapper = new BootStrapper(services)
                                        .UseEntityFrameworkCore <DbContextProyecto>()
                                        .UseAutoMapper()
                                        .UseQuartz()
                                        .UseSignalR()
                                        .UseTempFilesApi(Configuration["FolderStoreKeeper:BaseDir"])
                                        .UseScheduledTasks <TareasProgramadasStore>();

            return(services.AddITICore(bootStrapper));
        }
Exemplo n.º 24
0
 public static void RegisterServices(IServiceCollection services, string connectionString)
 {
     BootStrapper.RegisterServices(services, connectionString);
 }
Exemplo n.º 25
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     this.ViewModel = BootStrapper.Resolve <T>();
 }
Exemplo n.º 26
0
 private static void RegisterServices(IServiceCollection services)
 {
     // Adding dependencies from another layers (isolated from Presentation)
     BootStrapper.RegisterServices(services);
 }
Exemplo n.º 27
0
 public static void InitializeContainer(Container container)
 {
     BootStrapper.Register(container);
 }
Exemplo n.º 28
0
        public static void RegisterComponents()
        {
            var container = new BootStrapper();

            GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container.RegisterComponents());
        }
Exemplo n.º 29
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
            {
                Console.WriteLine(e.ExceptionObject);
            };

            PrintNameVersionAndCopyright();

            using (var consoleIconSwapper = new ConsoleIconSwapper())
            {
                consoleIconSwapper.ShowConsoleIcon(CoreResources.FavIcon);

                try
                {
                    var options = new ArgOptions(args);

                    if (options.ShowHelp)
                    {
                        ArgOptions.ShowHelpMessage(Console.Out, options);
                        return;
                    }

                    if (!options.XapPaths.Any() && !options.Dlls.Any())
                    {
                        throw new StatLightException("No xap or silverlight dll's specified.");
                    }

                    var inputOptions = new InputOptions()
                                       .SetWindowGeometry(options.WindowGeometry)
                                       .SetUseRemoteTestPage(options.UseRemoteTestPage)
                                       .SetMethodsToTest(options.MethodsToTest)
                                       .SetMicrosoftTestingFrameworkVersion(options.MicrosoftTestingFrameworkVersion)
                                       .SetTagFilters(options.TagFilters)
                                       .SetUnitTestProviderType(options.UnitTestProviderType)
                                       .SetNumberOfBrowserHosts(options.NumberOfBrowserHosts)
                                       .SetQueryString(options.QueryString)
                                       .SetWebBrowserType(options.WebBrowserType)
                                       .SetForceBrowserStart(options.ForceBrowserStart)
                                       .SetXapPaths(options.XapPaths)
                                       .SetDllPaths(options.Dlls)
                                       .SetReportOutputPath(options.XmlReportOutputPath)
                                       .SetReportOutputFileType(options.ReportOutputFileType)
                                       .SetContinuousIntegrationMode(options.ContinuousIntegrationMode)
                                       .SetOutputForTeamCity(options.OutputForTeamCity)
                                       .SetStartWebServerOnly(options.StartWebServerOnly)
                                       .SetIsRequestingDebug(options.IsRequestingDebug)
                    ;

                    TestReportCollection testReports = null;

                    try
                    {
                        TinyIoCContainer ioc = BootStrapper.Initialize(inputOptions);

                        var commandLineExecutionEngine = ioc.Resolve <RunnerExecutionEngine>();

                        testReports = commandLineExecutionEngine.Run();
                    }
                    catch (TinyIoCResolutionException tinyIoCResolutionException)
                    {
                        if (options.IsRequestingDebug)
                        {
                            throw;
                        }

                        throw ResolveNonTinyIocException(tinyIoCResolutionException);
                    }

                    if (testReports.FinalResult == RunCompletedState.Failure)
                    {
                        Environment.ExitCode = ExitFailed;
                    }
                    else
                    {
                        Environment.ExitCode = ExitSucceeded;
                    }
                }
                catch (AddressAccessDeniedException addressAccessDeniedException)
                {
                    Environment.ExitCode = ExitFailed;
                    var helpMessage = @"
Cannot run StatLight. The current account does not have the correct privilages.

Exception:
{0}

Try: (the following two steps that should allow StatLight to start a web server on the requested port)
     1. Run cmd.exe as Administrator.
     2. Enter the following command in the command prompt.
          netsh http add urlacl url=http://+:8887/ user=DOMAIN\user
".FormatWith(addressAccessDeniedException.Message);

                    WriteErrorToConsole(helpMessage, "Error");
                }
                catch (FileNotFoundException fileNotFoundException)
                {
                    HandleKnownError(fileNotFoundException);
                }
                catch (StatLightException statLightException)
                {
                    HandleKnownError(statLightException);
                }

                catch (Exception exception)
                {
                    HandleUnknownError(exception);
                }
            }
        }
        public static void AddDIConfiguration(this IServiceCollection services)
        {
            BootStrapper.RegisterServices(services);

            services.AddScoped(typeof(IPipelineBehavior <,>), typeof(MediatorMiddleware <,>));
        }
Exemplo n.º 31
0
 public async void DeleteTaskRow(int rowId)
 {
     await BootStrapper.Resolve <ITaskItemManager>().DeleteTask(taskItems[rowId]);
 }
Exemplo n.º 32
0
        public void Can_Get_Container()
        {
            var container = BootStrapper.GetContainer();

            Assert.IsNotNull(container);
        }
 private static void InitializeContainer(Container container)
 {
     //Registrando os módulos
     BootStrapper.Register(container);
 }
Exemplo n.º 34
0
 public StartWindowViewModel()
 {
     _optimazationContext = BootStrapper.Resolve <OptimizationContext>();
     _projectService      = new ListProjectService(_optimazationContext);
 }
 public void Setup()
 {
     BootStrapper.Run();
 }
Exemplo n.º 36
0
 protected override void OnStartup(StartupEventArgs e)
 {
     base.OnStartup(e);
     BootStrapper bootstrap = new BootStrapper();
     bootstrap.Run();
 }
Exemplo n.º 37
0
        protected void Application_Start()
        {
            BootStrapper.Initialize(GlobalConfiguration.Configuration);

            AutoMapperConfig.RegisterMappings();
        }
Exemplo n.º 38
0
 protected void Application_Stop()
 {
     BootStrapper.Dispose();
 }
Exemplo n.º 39
0
 public void Init()
 {
     AppBootstrapper.Register <DtoMapperInitializer>();
     BootStrapper.Start();
 }
Exemplo n.º 40
0
        static void Main(string[] args)
        {
            var app = new CommandLineApplication
            {
                Name        = "EjercicioToken.Tools.DataBaseInitialization",
                Description = "Herramienta para inicializar y/o actualizar la base de datos de un proyecto nuevo con la plantilla del ITI.Core"
            };


            var modeOption = app.Option("-m|--mode",
                                        "Test/Produccion -> Por defecto Produccion",
                                        CommandOptionType.SingleValue);

            var connectionStringOption = app.Option("-cs|--connectionString",
                                                    "Cadena de conexion de la base de datos",
                                                    CommandOptionType.SingleValue);

            app.HelpOption("-? | -h | --help");

            app.OnExecute(() =>
            {
                Console.WriteLine("Ejecutando EjercicioToken.Tools.DataBaseInitialization ...");


                if (!connectionStringOption.HasValue())
                {
                    Console.WriteLine("Es obligatorio especificar la cadena de conexión de la base de datos. Use el parametro -connectionString");

                    app.ShowHelp();

                    app.ShowHint();

                    return(-1);
                }

                connectionString = connectionStringOption.Value();


                if (modeOption.HasValue())
                {
                    mode = modeOption.Value().ToLower();
                }

                IServiceCollection services = new ServiceCollection();

                services.AddTransient <IPrincipalAccessor, NullPrincipalAccessor>();
                services.AddTransient <IUserSession, UserSession>();

                services.AddDbContext <ITICoreTemplateDbContext>(options =>
                                                                 options.UseSqlServer(connectionString));

                BootStrapper bootStrapper = new BootStrapper(services)
                                            .UseEntityFrameworkCore <ITICoreTemplateDbContext>();


                bootStrapper.Compose();

                var serviceProvider = services.BuildServiceProvider();

                try
                {
                    var context = serviceProvider.GetRequiredService <ITICoreTemplateDbContext>();

                    switch (mode)
                    {
                    case "test":
                        Console.WriteLine("Inicializando en modo Test:");

                        Console.WriteLine("Eliminando la base de datos.");

                        context.Database.EnsureDeleted();

                        Console.WriteLine("Creando la base de datos y cargando los datos de prueba.");
                        Console.WriteLine("Esta operación puede tardar unos segundos");

                        context.Database.Migrate();

                        DbInitializer.Initialize(context);
                        break;

                    case "prod":
                    default:
                        Console.WriteLine("Inicializando en modo Producción:");


                        Console.WriteLine("Aplicando las migrations.");
                        Console.WriteLine("Esta operación puede tardar unos segundos");

                        context.Database.Migrate();

                        break;
                    }
                }
                catch (Exception ex)
                {
                    Console.BackgroundColor = ConsoleColor.Red;

                    Console.WriteLine("Ha ocurrido el siguiente error al ejecutar la herramienta");
                    Console.WriteLine(ex.Message);

                    if (ex.InnerException != null)
                    {
                        Console.WriteLine(ex.InnerException.Message);
                    }

                    var logger = serviceProvider.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An error occurred while seeding the database.");

                    Console.ResetColor();

                    CountDown();

                    return(-1);
                }

                Console.WriteLine("Fin del proceso");


                CountDown();

                return(0);
            });

            app.Execute(args);
        }
Exemplo n.º 41
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BootStrapper.RunConfig();
 }
Exemplo n.º 42
0
 public HomeController()
 {
     BootStrapper.Start();
     _appServiceBase = BootStrapper.container.GetInstance <IAppServiceBase>();
 }
Exemplo n.º 43
0
        private void AssociatedObjectOnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var messengerHub = BootStrapper.Resolve <ITinyMessengerHub>();

            messengerHub.Publish(new TabControlChangedMessage(this));
        }
 private static void InitializeContainer(Container container)
 {
     BootStrapper.Register(container);
     Systrade.Clientes.CrossCutting.BootStrapper.Register(container);
 }
Exemplo n.º 45
0
 public void Initialise()
 {
     BootStrapper.Init();
 }
Exemplo n.º 46
0
        public void A_FinisedEvaSession_creates_a_new_Session_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();
            var message = GenerateMessage(aggr);
            //2.- Emit message
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });
            //3.- Load the saved country
            var repository = new SessionRepository(_configuration.TestServer);
            var session = repository.Get(aggr.Id);
            //4.- Check equality
            Assert.Equal(aggr.Id, session.Id);
            Assert.Equal(aggr.CommissionId, session.CommissionId);
            Assert.Equal(aggr.EndTime.Value.Second, session.EndTime.Value.Second);
            Assert.Equal(aggr.InitialTime.Value.Second, session.InitialTime.Value.Second);
            Assert.Equal(aggr.InvoiceId, session.InvoiceId);
            Assert.Equal(aggr.InterpretationDone, session.InterpretationDone);
            Assert.Equal(aggr.SignedDate.Value.Second, session.SignedDate.Value.Second);
            Assert.Equal(aggr.GuardianId, session.GuardianId);
            Assert.Equal(aggr.PartnerId, session.PartnerId);
            Assert.Equal(aggr.PatientId, session.PatientId);
            Assert.Equal(aggr.ServiceLevelId, session.ServiceLevelId);
            Assert.Equal(aggr.ServiceId, session.ServiceId);
            Assert.Equal(aggr.MediaId, session.MediaId);
            Assert.Equal(aggr.MachineId, session.MachineId);
            Assert.Equal(aggr.PayableId, session.PayableId);
            Assert.Equal(aggr.CommissionId, session.CommissionId);
            Assert.Equal(aggr.TimeStamp.Second, session.TimeStamp.Second);

            var appoinment = session.Appointment.First();
            Assert.Equal(appoinment.Id, aggr.Appointment.First().Id);
            Assert.Equal(appoinment.InitialTime.Second, aggr.Appointment.First().InitialTime.Second);
            Assert.Equal(appoinment.FinalTime.Second, aggr.Appointment.First().FinalTime.Second);
            Assert.Equal(appoinment.MachineId, aggr.Appointment.First().MachineId);
            Assert.Equal(appoinment.MediaId, aggr.Appointment.First().MediaId);
            Assert.Equal(appoinment.PartnerId, aggr.Appointment.First().PartnerId);
            Assert.Equal(appoinment.PatientId, aggr.Appointment.First().PatientId);
            Assert.Equal(appoinment.PayableId, aggr.Appointment.First().PayableId);
            Assert.Equal(appoinment.ServiceId, aggr.Appointment.First().ServiceId);
            Assert.Equal(appoinment.ServiceLevelId, aggr.Appointment.First().ServiceLevelId);
            Assert.Equal(appoinment.ServiceTypeId, aggr.Appointment.First().ServiceTypeId);
            Assert.Equal(appoinment.SessionId, aggr.Appointment.First().SessionId);
            Assert.Equal(appoinment.StatusType, aggr.Appointment.First().StatusType);
            Assert.Equal(appoinment.TimeZoneId, aggr.Appointment.First().TimeZoneId);
            Assert.Equal(appoinment.TimeStamp.Second, aggr.Appointment.First().TimeStamp.Second);

            var sessionDevice = session.SessionDevice.First();
            Assert.Equal(sessionDevice.Id, aggr.SessionDevice.First().Id);
            Assert.Equal(sessionDevice.DeviceGroup, aggr.SessionDevice.First().DeviceGroup);
            Assert.Equal(sessionDevice.DeviceId, aggr.SessionDevice.First().DeviceId);
            Assert.Equal(sessionDevice.SapCode, aggr.SessionDevice.First().SapCode);
            Assert.Equal(sessionDevice.SerialNumber, aggr.SessionDevice.First().SerialNumber);
            Assert.Equal(sessionDevice.SessionId, aggr.SessionDevice.First().SessionId);
            Assert.Equal(sessionDevice.TimeStamp.Second, aggr.SessionDevice.First().TimeStamp.Second);

            var diagnosis = session.Diagnosis.First();
            Assert.Equal(diagnosis.Id, aggr.Diagnosis.First().Id);
            Assert.Equal(diagnosis.Appraisal, aggr.Diagnosis.First().Appraisal);
            Assert.Equal(diagnosis.Name, aggr.Diagnosis.First().Name);
            Assert.Equal(diagnosis.SessionId, aggr.Diagnosis.First().SessionId);
            Assert.Equal(diagnosis.TimeStamp.Second, aggr.Diagnosis.First().TimeStamp.Second);
        }
Exemplo n.º 47
0
 public App()
 {
     var bootstrapper = new BootStrapper();
     bootstrapper.Run();
 }
 protected void Application_Start(object sender, EventArgs e)
 {
     BootStrapper.ConfigureDependencies();
 }