Exemple #1
0
        public void ShouldReturnNullProvider()
        {
            Assert.AreSame(NullProvider.GetInstance(), ProviderFactory.GetProvider(null));

            Assert.AreSame(NullProvider.GetInstance(), ProviderFactory.GetProvider("Dummy Provider"));

            Assert.AreSame(NullProvider.GetInstance(), ProviderFactory.GetProvider("http://wp.pl"));
        }
Exemple #2
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage: ParseBenchmark <format>");

                return;
            }

            string formatFile  = args[0];
            string programText = File.ReadAllText(formatFile, IrbisEncoding.Ansi);

            try
            {
                IrbisEncoding.RelaxUtf8();

                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();

                using (NullProvider provider = new NullProvider())
                {
                    provider.Database = "IBIS";

                    PftContext context = new PftContext(null);
                    context.SetProvider(provider);

                    for (int i = 0; i < 10000; i++)
                    {
                        PftFormatter formatter = new PftFormatter(context);
                        formatter.ParseProgram(programText);
                    }
                }

                stopwatch.Stop();

                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine
                (
                    "Elapsed: {0} sec",
                    stopwatch.Elapsed.ToSecondString()
                );
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
 protected PaymentProvider GetProvider()
 {
     return(NullProvider.GetInstance());
 }