Exemplo n.º 1
0
        private static void testLibcall()
        {
            LibClass libclass = new LibClass();

            Console.WriteLine(libclass.showMix("abcd", 5));
            Console.WriteLine(libclass.showMulti("bcde ", 3));
        }
 public ValuesController(IOptionsSnapshot <Configs> config, IConfiguration conf, LibClass _lib, SingleClass _single)
 {
     Config = config.Value;
     _conf  = conf;
     lib    = _lib;
     single = _single;
 }
Exemplo n.º 3
0
        public void TryStuff()
        {
            RandNum    = new Random().Next(100);
            RandString = RandNum.ToString() + "abc";

            // checks whats been added to il for static constructor

            // read in static consructor with decompiler and see what load field value is set to

            var aa = typeof(StaticMan);

            var bb = typeof(StaticTemplateClass <int>);

            var fieldVal = TestField;

            /*var z = typeof(StaticTemplateClass<int>);
             *
             * foreach (var x in z.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static).OrderBy(f => f.Name))
             * {
             *  var name = x.Name;
             *
             *  var value = x.GetValue(null);
             *
             *  int i = 0;
             *  i++;
             * }*/

            try
            {
                StaticMan.HolyCow();

                var a = new NestedClass();

                string yy = null;
                yy = testVar;
                //testVar = "hello";

                a.DoStuff();

                var x = new int[] { 1, 2, 3, 4 };

                var y = x.Where(i => i > 2).ToArray();
            }
            catch (Exception ex)
            {
            }


            var t = new LibClass();

            t.TestMe = 5;
            t.DoMoreStuff();
        }
Exemplo n.º 4
0
        private void TestLibClass()
        {
            var instance = new LibClass();

            instance.PublicMethod();
#warning Cannot call protected method from not derived class in different namespace but same assembly
            //instance.ProtectedMethod();
            instance.InternalMethod();
            instance.ProtectedInternalMethod();
#warning Cannot call private method from any class in different namespace but same assembly
            //instance.PrivateMethod();
        }
Exemplo n.º 5
0
 public static void Main(String[] args)
 {
     if (args.Length != 1)
     {
         Console.WriteLine("Usage: Prog <yourname>");
     }
     else
     {
         Console.WriteLine("Hello, " + args[0]);
         ModClass.Hello(args[0]);
         LibClass.Hello(args[0]);
     }
 }
        public void ApproximatePiTest()
        {
            var rnd = new Random();

            var pts    = Enumerable.Range(0, 1000000).Select(i => new Point(rnd.NextDouble(), rnd.NextDouble()));
            var approx = LibClass.Approx(pts.ToArray());

            const double errorMargin = 0.01;

            _console.WriteLine($"Approx: {approx}. Off by {approx - Math.PI}. AllowedMargin: {errorMargin}");

            approx.Should().BeInRange(Math.PI - errorMargin, Math.PI + errorMargin);
        }
        public async Task ParallelIncrementingTest()
        {
            var lib = new LibClass();

            const int p = 1000;

            const int expected = p * (p + 1) / 2;


            var result = await lib.ParallelIncrement(p);

            result.Should().Be(expected);

            //And again...
            result = await lib.ParallelIncrement(p);

            result.Should().Be(expected * 2);
        }
Exemplo n.º 8
0
        public void TryStuff()
        {
            RandNum    = new Random().Next(100);
            RandString = RandNum.ToString() + "abc";

            // checks whats been added to il for static constructor

            // read in static consructor with decompiler and see what load field value is set to

            var aa = typeof(StaticMan);

            var bb = typeof(StaticTemplateClass <int>);

            var fieldVal = TestField;

            try
            {
                StaticMan.HolyCow();

                var a = new NestedClass();

                string yy = null;
                yy = testVar;
                //testVar = "hello";

                a.DoStuff();

                var x = new int[] { 1, 2, 3, 4 };

                var y = x.Where(i => i > 2).ToArray();
            }
            catch (Exception ex)
            {
            }


            var t = new LibClass();

            t.TestMe = 5;
            t.DoMoreStuff();
        }
Exemplo n.º 9
0
        public void TryStuff()
        {
            RandNum = new Random().Next(100);
            RandString = RandNum.ToString() + "abc";

            // checks whats been added to il for static constructor

            // read in static consructor with decompiler and see what load field value is set to

            var aa = typeof(StaticMan);

            var bb = typeof(StaticTemplateClass<int>);

            var fieldVal = TestField;

            /*var z = typeof(StaticTemplateClass<int>);

            foreach (var x in z.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static).OrderBy(f => f.Name))
            {
                var name = x.Name;

                var value = x.GetValue(null);

                int i = 0;
                i++;
            }*/

            try
            {
                StaticMan.HolyCow();

                var a = new NestedClass();

                string yy = null;
                yy = testVar;
                //testVar = "hello";

                a.DoStuff();

                var x = new int[] { 1, 2, 3, 4 };

                var y = x.Where(i => i > 2).ToArray();
            }
            catch (Exception ex)
            {

            }

            var t = new LibClass();
            t.TestMe = 5;
            t.DoMoreStuff();
        }
 public MyLibClassSimpleDecorator1(LibClass obj)
     : base(obj)
 {
 }
Exemplo n.º 11
0
 public void CapabilitiesTests(Capabilities granted, Capabilities toTest, bool expected)
 {
     LibClass.AnyGranted(granted, toTest).Should().Be(expected);
 }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
            var lib = new LibClass();

            Console.WriteLine($"Hello Transitive: {lib.Value}!");
        }
Exemplo n.º 13
0
        public void AveragingTests()
        {
            var averageResult = LibClass.Average(_countableSet);

            averageResult.Should().Be(4.2);
        }
 public MyLibClassDefaultDecoratorBase(LibClass obj)
 {
     this.backingObject = obj;
 }
Exemplo n.º 15
0
 public void ArraySizingTests(int numPanels, int[] expectedSizes)
 {
     LibClass.GetPanelArrays(numPanels).Should().BeEquivalentTo(expectedSizes);
 }
Exemplo n.º 16
0
        public void TryStuff()
        {
            RandNum = new Random().Next(100);
            RandString = RandNum.ToString() + "abc";

            // checks whats been added to il for static constructor

            // read in static consructor with decompiler and see what load field value is set to

            var aa = typeof(StaticMan);

            var bb = typeof(StaticTemplateClass<int>);

            var fieldVal = TestField;

            try
            {
                StaticMan.HolyCow();

                var a = new NestedClass();

                string yy = null;
                yy = testVar;
                //testVar = "hello";

                a.DoStuff();

                var x = new int[] { 1, 2, 3, 4 };

                var y = x.Where(i => i > 2).ToArray();
            }
            catch (Exception ex)
            {

            }

            var t = new LibClass();
            t.TestMe = 5;
            t.DoMoreStuff();
        }
Exemplo n.º 17
0
        } // end enter button

        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        private void btnReset_Click(object sender, EventArgs e)
        {
            StreamReader sr;                           // new reader
            string       file;                         // holds file
            DialogResult result;                       // holds message box result

            if (string.IsNullOrEmpty(txtNewData.Text)) // if empty
            {
                MessageBox.Show("No input detected", "No input file",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
            else // if txtbox not empty
            {
                result = MessageBox.Show("WARNING: This can't be reverted!" +
                                         " Do you wish to continue?", "WARNING!",
                                         MessageBoxButtons.AbortRetryIgnore,
                                         MessageBoxIcon.Warning);

                if (result == DialogResult.Abort)      // if abort
                {
                    this.Close();                      // close current form
                }
                else if (result == DialogResult.Retry) //had to have retry
                {
                }
                else // if they hit ignore
                {
                    try // try for ID accuracy
                    {
                        sr   = new StreamReader(txtNewData.Text); // open file
                        file = sr.ReadLine();                     //read first line

                        if (file != null)                         // if not empty
                        {
                            frmParent.data.FirstPos();            //set first pos
                            // while not at end delete current record
                            while (!frmParent.data.EndofList())
                            {                              // repeats all elements in list
                                frmParent.data.Delete();   // delete rec
                                frmParent.data.FirstPos(); // reset first pos
                            }

                            // creates a new library class and overwrites previous then tells user
                            LibClass NewData = new LibClass(txtNewData.Text);
                            frmParent.data = NewData;
                            MessageBox.Show("DATABASE RESET", "Renaissance!",
                                            MessageBoxButtons.OK,
                                            MessageBoxIcon.Information);
                            this.Close(); // close form
                        } // end if
                        else// if file is not correct it aborts new database
                        {
                            MessageBox.Show("Invalid data in file", "Invalid File",
                                            MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                        }
                    }
                    catch (Exception ex) // if id is bad from start comes here
                    {
                        MessageBox.Show("File not found", "Invalid File",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    } // end catch
                }     // end else for message box
            }         // end else if txt not empty
        }             // end reset button