Add() public method

public Add ( char c ) : void
c char
return void
Ejemplo n.º 1
0
    public static void Main(string[] args)
    {
        TextInput input = new NumericInput();

        input.Add('a');
        input.Add('0');
        Console.WriteLine(input.GetValue());
    }
Ejemplo n.º 2
0
    public void Adding_numeric_characters_to_NumericInput()
    {
        TextInput input = new NumericInput();

        input.Add('1');
        input.Add('0');
        Assert.Equal("10", input.GetValue());
    }
Ejemplo n.º 3
0
    public static void test()
    {
        TextInput input = new NumericInput();

        input.Add('1');
        input.Add('a');
        input.Add('0');
        Console.WriteLine(input.GetValue());
    }
Ejemplo n.º 4
0
        public void AddTestIgnoreNonNumeric()
        {
            TextInput input = new NumericInput();

            input.Add('1');
            input.Add('m');
            input.Add('0');
            Assert.AreEqual("10", input.GetValue());
        }
Ejemplo n.º 5
0
        public void TextNumInputTest()
        {
            TextInput input = new NumericInput();

            input.Add('1');
            input.Add('a');
            input.Add('0');
            input.Add(' ');

            Assert.AreEqual(input.GetValue(), "10");
        }
Ejemplo n.º 6
0
        public void TextInput_GetValue()
        {
            // Arrange.
            TextInput input = new NumericInput();

            input.Add('1');
            input.Add('a');
            input.Add('0');
            string expected = "10";

            // Act.
            string actual = input.GetValue();

            // Assert.
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 7
0
    public static void Main(string[] args)
    {
        string d = "tes";

        d.Equals("tsest", StringComparison.InvariantCultureIgnoreCase);

        NumericInput input = new NumericInput();

        input.Add('1');
        input.Add('a');
        input.Add('0');
        Console.WriteLine(input.GetValue());

        Car car = new Car();

        car.run();
    }
Ejemplo n.º 8
0
        public void NumuericInput_accepts_numeric_characters_only(string expected, params char[] values)
        {
            var input = new NumericInput();

            foreach (var value in values)
            {
                input.Add(value);
            }

            var result = input.GetValue();

            Assert.Equal(expected, result);
        }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            // When we create any data type to system.object method then clr convert this data type to object's method and this it is stored in server's heap area as system.object object datatype
            // It can be done implicitly
            int    i = 1111;
            Object o = i;
            //Console.WriteLine(o);

            // When we create an sysrem.object type datatype and stored a value in it than we have convert to speciific datatype like string or integer then we have to do unboxing.
            // when we are doiing unboxing we need to do it explicitly like using type converting
            object o1 = "Jappan";
            string s1 = (string)o1;
            //Console.Write(s1);

            TextInput input = new NumericInput();

            input.Add('1');
            input.Add('a');
            input.Add('0');
            Console.WriteLine(input.GetValue());


            Console.WriteLine(IsPalindrome("Deleveled"));

            // XML
            string xml =
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                "<folder name=\"c\">" +
                "<folder name=\"program files\">" +
                "<folder name=\"uninstall information\" />" +
                "</folder>" +
                "<folder name=\"users\" />" +
                "</folder>";

            //foreach (string name in FolderNames(xml, 'u'))
            //{
            //    Console.WriteLine(name);
            //}

            // c# prooperties example
            Test1 test = new Test1();

            test.hours = 22;
            //Console.WriteLine($"Time : {test.hours}");
            //test.print();

            // Abstraction method
            employee e1 = new employee();

            e1.address      = "Krishannangar";
            e1.isManagement = true;
            e1.name         = "Jappan bhavsar";
            e1.userID       = 0;

            Console.WriteLine($"name is {e1.name} and their id is {e1.userID} and thier address is  {e1.address} " +
                              $"and he is {e1.isManagement}");

            // Abstraction Method example
            derivedClass d1 = new derivedClass();

            d1.abstractMethod();
            Console.Write($"x = {d1.x} and y {d1.y}");

            // Indexer example
            Indexer1 ind = new Indexer1();

            ind[0] = "Jappan";
            ind[1] = "tanvi";
            ind[2] = "neel";
            ind[3] = "krishna";
            ind[4] = "karzari";

            foreach (string str in ind.getString())
            {
                Console.Write("string is " + str + "\n\r");
            }

            // Static constructer
            staticConstructer sc  = new staticConstructer();
            staticConstructer sc2 = new staticConstructer();

            // Interface use
            interfaceImplememnter imp1 = new interfaceImplememnter();

            imp1.print();

            interfaceImp1 imp2 = new interfaceImp1();

            imp2.print();


            // Method Overridding
            abc a = new abc();

            a.print();

            def d = new def();

            d.print();

            efg e = new efg();

            e.print();


            // Opearator Overloading
            box b1 = new box();

            b1.length = 10;
            b1.width  = 20;
            b1.height = 30;

            box b2 = new box();

            b2.width  = 90;
            b2.length = 80;
            b2.height = 70;

            box b3 = new box();

            b3 = b1 + b2;

            Console.WriteLine($"Box 3 has length of {b3.length} , and width of {b3.width} and the height of {b3.height}");

            Console.ReadKey();
        }