public static void Main()
        {
            // 1st test option:
            // You can run the Unit Tests from the Visual Studio menu:
            // BUILD -> Build Solution
            // TEST -> Windows -> Test Explorer (you will see in the Test Explorer window: Not Run Tests or Passed Tests
            // and above it:  Run All
            // Please, click on Run All, and read the ClassPersonTests.cs file for more details

            // 2nd test option: input
            Console.Write("Please, enter a name: ");
            var name = Console.ReadLine();
            Console.Write("Please, enter a a value for age: ");
            var age = ReadAge(); // validates integer input
            Console.Write("Please, enter an email: ");
            var email = Console.ReadLine();

            // try to create a person with the above input data
            // check for exceptions - in case of multipple exceptions, only the first one is displayed
            try
            {
                if (email != string.Empty)
                {
                    var person1 = new Person(name, age);
                    Console.WriteLine(person1);
                }

                var person2 = new Person(name, age, email);
                Console.WriteLine(person2);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: {0}\n{1}", e.GetType(), e.Message);
            }
        }
 static void Main(string[] args)
 {
     Person pesho = new Person("Pesho", 20, "*****@*****.**");
     Person gosho = new Person("Gosho", 18);
     Console.WriteLine(pesho);
     Console.WriteLine(gosho);
 }
Example #3
0
        static void Main()
        {
            Person mitko = new Person("Mitko", 26);
            Person sasho = new Person("Sasho", 30, "*****@*****.**");

            Console.WriteLine(mitko);
            Console.WriteLine(sasho);
        }
        static void Main(string[] args)
        {
            var pesho = new Person("Pesho",23);
            var stamat = new Person("Stamcho", 54, "*****@*****.**");
            var joro = new Person("Joro Picha",14,"mahniGoToq.com");

            Console.WriteLine(pesho);
            Console.WriteLine(stamat);
            Console.WriteLine(joro);
        }
Example #5
0
        static void Main()
        {
            var gosho = new Person("Gosho", 32);
            var pesho = new Person("Pesho", 24, "*****@*****.**");
            var ivan = new Person("Ivan", 32, null);

            Console.WriteLine(gosho);
            Console.WriteLine(pesho);
            Console.WriteLine(ivan);
        }
Example #6
0
 static void Main(string[] args)
 {
     Person x = new Person("Bobko",25);
     Console.WriteLine(x);
 }
Example #7
0
 private static void Main()
 {
     Person stamat = new Person("Stamat", 86);
     Console.WriteLine(stamat);
 }
 public void Person_PersonWithValidNameAndAge_ShouldPassTest()
 {
     var personWithValidNameAndAge = new Person("X", 1);
 }
 public void Person_PersonWithValidNameAgeAndEmail_ShouldPassTest()
 {
     var personWithValidNameAgeAndEmail = new Person("X", 100, "*****@*****.**");
 }
 public void Name_WhenNameIsEmpty_ShouldThrowArgumentNullException()
 {
     var personWithEmptyName = new Person(string.Empty, 12);
 }
 public void Email_InvalidEmailFormat_ShouldThrowArgumentException()
 {
     var personWithInvalidEmail = new Person("X", 100, "asdf");
 }
 public void Email_EmptyStringEmail_ShouldThrowArgumentException()
 {
     var personWithEmptyStringEmail = new Person("X", 100, string.Empty);
 }
 public void Age_WhenAgeIsMoreThan100_ShouldThrowArgumentOutOfRangeException()
 {
     var personWithAgeMoreThan100 = new Person("H", 122);
 }