Exemple #1
0
        static async Task Main(string[] args)
        {
            var context = new RatesContextFactory().CreateDbContext(ConnectionString);

            var fromRates = await context.ActualRates
                            .Select(x => x.CurrencyFrom)
                            .Distinct()
                            .ToArrayAsync();

            var toRates = await context.ActualRates
                          .Select(x => x.CurrencyTo)
                          .Distinct()
                          .ToArrayAsync();

            var requestMaker = new RequestsMaker(fromRates, toRates);

            var generator = new PhantomAmmoGeneratorBuilder()
                            .AddSources(requestMaker.MakeGets())
                            .Build();

            using (var file = File.CreateText(GetFilePath()))
            {
                for (int i = 0; i < RequestsCount; i++)
                {
                    file.Write(generator.GetNext());
                }
            }

            Console.WriteLine($"Get:{requestMaker.GetCount}");
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var requestMaker = new RequestsMaker();

            var generator = new PhantomAmmoGeneratorBuilder()
                            .AddSources(requestMaker.MakeGets())
                            .Build();

            using (var file = File.CreateText(GetFilePath()))
            {
                for (int i = 0; i < RequestsCount; i++)
                {
                    file.Write(generator.GetNext());
                }
            }

            Console.WriteLine($"Get:{requestMaker.GetCount}");
        }