static async Task Main(string[] args)
        {
            IConfiguration configuration = AppSettingsFactory.GetAppSettings();

            ConsoleHelper.WriteLine("Starting client...", ConsoleColor.Yellow);
            var       clientIpEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 0);
            var       serverIpEndPoint = new IPEndPoint(IPAddress.Parse(configuration["ServerIpAddress"]), ProtocolSpecification.Port);
            TcpClient client           = new TcpClient(clientIpEndPoint);

            ConsoleHelper.WriteLine("Attempting connection to server...", ConsoleColor.Yellow);
            client.Connect(serverIpEndPoint);
            NetworkStream stream = client.GetStream();
            var           protocolCommunication = new ProtocolCommunication(stream);

            IPageNavigation navigation = new PageNavigation(protocolCommunication);

            navigation.GoToPage(IPageNavigation.LandingPage);

            while (navigation.Top() != null)
            {
                ConsoleHelper.Clear();
                await navigation.Top().RenderAsync();
            }

            await protocolCommunication.SendRequestAsync(new LogoutRequest());
        }
Exemplo n.º 2
0
        public static void SetUpBeforeTestRun()
        {
            var appSettingsFactory = new AppSettingsFactory();

            _appSettings = appSettingsFactory.LoadAppSettings();

            SetUpHttpClientFactory();
        }
Exemplo n.º 3
0
        static JsonSettingLoaderTests()
        {
            string         currentDir        = Directory.GetCurrentDirectory();
            string         jsonFile          = Path.Combine(currentDir, "SettingsTestData.json");
            ISettingLoader jsonSettingLoader = AppSettingsFactory.GetJsonSettingLoader(jsonFile);

            _settings = new JsonSettings();
            AppSettingsLoader.Load(jsonSettingLoader, ref _settings);
        }
        public AppDbContext CreateDbContext(string[] args)
        {
            var optionsBuilder = new DbContextOptionsBuilder <AppDbContext>();

            var configuration = AppSettingsFactory.BuildConfiguration();

            var connectionString = configuration.GetConnectionString("Default");

            optionsBuilder.UseSqlServer(connectionString);

            return(new AppDbContext(optionsBuilder.Options));
        }
Exemplo n.º 5
0
        public Startup(IHostingEnvironment env)
        {
            Configuration = AppSettingsFactory.BuildConfiguration();
            var netpipsAppSettings = Configuration.GetSection("Netpips").Get <NetpipsSettings>();

            AppAsserter.AssertCliDependencies();
            AppAsserter.AssertSettings(netpipsAppSettings);

            SetupLogger(netpipsAppSettings.LogsPath);

            // removes default claim mapping
            JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
        }
Exemplo n.º 6
0
 public HttpResponseMessage GetAppSettings()
 {
     try
     {
         IAppSettingsFactory _factory = AppSettingsFactory.GetInstance();
         IAppSettingsManager _manager = _factory.GetManager();
         var _appSettings             = _manager.GetAppSettings();
         return(Request.CreateResponse(HttpStatusCode.OK, _appSettings));
     }
     catch (Exception _ex)
     {
         var _message = string.Format("There was an error processing the request. {0}", _ex.Message);
         Log.Error("AppSettingsController.GetAppSettings", "There was an error processing the request. Exception: {0}", _ex);
         HttpResponseMessage _response = Request.CreateResponse(HttpStatusCode.InternalServerError, _message);
         throw new HttpResponseException(_response);
     }
 }
Exemplo n.º 7
0
        private static BlogSyncService GetBlogSyncService(IDocumentStore documentStore)
        {
            if (documentStore == null)
            {
                throw new ArgumentNullException(nameof(documentStore));
            }

            var blogSource = AppSettingsFactory.BuildBlogSource((username, password) => new BloggerBlogSource(password));

            var dataStorage = new RavenDbDataStorage(documentStore);

            var syncConfig = new BlogSyncConfiguration(blogSource, dataStorage, blogSettings: BlogSettingsLazy.Value);

            syncConfig.TransformersProvider.Transformers.Clear();

            var blogSync = new BlogSyncService(syncConfig);

            return(blogSync);
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            IConfiguration configuration = AppSettingsFactory.GetAppSettings();

            var channel = GrpcChannel.ForAddress(configuration["GrpcServer"]);

            _logServiceRemote = new LogServiceRemote(channel);

            // Rabbit connection init
            string rabbitHost = configuration["RabbitHost"];

            using var rabbitClient = new RabbitQueueHelper(
                      rabbitHostname: rabbitHost,
                      queueName: configuration["LogQueueName"]
                      );
            rabbitClient.QueueDeclare();
            rabbitClient.ReceiveMessages(LogRemoteHandler);

            Console.WriteLine($"Listening queue: {configuration["LogQueueName"]}");
            Console.Read();
        }
Exemplo n.º 9
0
 /// <summary>
 /// Fetches a configuration based on NETPIPS_TEST_ prefix for env vars
 /// </summary>
 /// <returns></returns>
 private static IConfigurationRoot GetTestConfiguration()
 {
     return(AppSettingsFactory.BuildTestConfiguration());
 }