Exemple #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.Run(async(context) =>
            {
                var x              = new Lib.Class1();
                x.PropertyChanged += (sender, args) =>
                {
                    ((Lib.Class1)sender).Id = 123;
                };

                x.Secret = "";
                await context.Response.WriteAsync("Hello World! " + x.Id);
                await context.Response.WriteAsync("\n" + x.GetType().Assembly.FullName);
                foreach (var i in x.GetType().GetInterfaces())
                {
                    await context.Response.WriteAsync("\n    : " + i.FullName);
                }
            });
        }
        static void PrintSeqs()
        {
            Lib.Class1 c = new Lib.Class1();

            foreach (var n in new ulong[] { UInt64.MaxValue, 42, 12297829382473034410, UInt64.MinValue })
            {
                PrintSeq(c.EnumerateSquaresImpl1(n));
                PrintSeq(c.EnumerateSquaresImpl2(n));
                PrintSeq(c.EnumerateSquaresImpl3(n));
                PrintSeq(c.EnumerateSquaresImpl4(n));
            }
        }
Exemple #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.Run(async(context) =>
            {
                var x              = new Lib.Class1();
                x.PropertyChanged += (sender, args) =>
                {
                    ((Lib.Class1)sender).Id = 123;
                };
                x.Secret = "";
                await context.Response.WriteAsync("Hello World! " + x.Id);
            });
        }
Exemple #4
0
        public void TestMethod()
        {
            var result = new Lib.Class1().MagicNumber(3);

            Assert.AreEqual(9, result);
        }
Exemple #5
0
 static void Main(string[] args)
 {
     Lib.Class1 c = new Lib.Class1();
     Console.WriteLine(c.test());
     Console.ReadLine();
 }
        static void Test(int iterations, ulong value)
        {
            Console.WriteLine("------------------------");
            Console.WriteLine("iterations = {0}, value = {1}", iterations, value);

            int SIZE = iterations;

            List <ulong> xs;

            Lib.Class1 c = new Lib.Class1();

            xs = new List <ulong>(SIZE);
            var t1 = InstrumentedOperation.Test(() =>
            {
                for (int i = 0; i < SIZE; ++i)
                {
                    xs.AddRange(c.EnumerateSquaresImpl1(value));
                }
            }, "EnumerateSquaresImpl1");

            Console.WriteLine(xs.Count);
            Console.WriteLine(t1);

            xs = new List <ulong>();
            var t2 = InstrumentedOperation.Test(() =>
            {
                for (int i = 0; i < SIZE; ++i)
                {
                    xs.AddRange(c.EnumerateSquaresImpl2(value));
                }
            }, "EnumerateSquaresImpl2");

            Console.WriteLine(xs.Count);
            Console.WriteLine(t2);

            xs = new List <ulong>(SIZE);
            var t3 = InstrumentedOperation.Test(() =>
            {
                for (int i = 0; i < SIZE; ++i)
                {
                    xs.AddRange(c.EnumerateSquaresImpl3(value));
                }
            }, "EnumerateSquaresImpl3");

            Console.WriteLine(xs.Count);
            Console.WriteLine(t3);

            xs = new List <ulong>(SIZE);
            var t4 = InstrumentedOperation.Test(() =>
            {
                for (int i = 0; i < SIZE; ++i)
                {
                    xs.AddRange(c.EnumerateSquaresImpl4(value));
                }
            }, "EnumerateSquaresImpl4");

            Console.WriteLine(xs.Count);
            Console.WriteLine(t4);

            Console.WriteLine("------------------------");
        }